@@ -233,6 +233,75 @@ describe('getPermittedHooks', () => {
233233 const { runSaga, store } = createStore ( getMockOptions ( ) ) ;
234234 const controllerMessenger = getRootControllerMessenger ( ) ;
235235
236+ it ( 'returns the `hasPermission` hook' , async ( ) => {
237+ const { snapId, close } = await getMockServer ( {
238+ manifest : getSnapManifest ( ) ,
239+ } ) ;
240+
241+ const location = detectSnapLocation ( snapId , {
242+ allowLocal : true ,
243+ } ) ;
244+
245+ const snapFiles = await fetchSnap ( snapId , location ) ;
246+
247+ const { hasPermission } = getPermittedHooks (
248+ snapId ,
249+ snapFiles ,
250+ controllerMessenger ,
251+ runSaga ,
252+ ) ;
253+
254+ expect ( hasPermission ( 'snap_manageState' ) ) . toBe ( true ) ;
255+
256+ await close ( ) ;
257+ } ) ;
258+
259+ it ( 'returns the `getUnlockPromise` hook' , async ( ) => {
260+ const { snapId, close } = await getMockServer ( {
261+ manifest : getSnapManifest ( ) ,
262+ } ) ;
263+
264+ const location = detectSnapLocation ( snapId , {
265+ allowLocal : true ,
266+ } ) ;
267+
268+ const snapFiles = await fetchSnap ( snapId , location ) ;
269+
270+ const { getUnlockPromise } = getPermittedHooks (
271+ snapId ,
272+ snapFiles ,
273+ controllerMessenger ,
274+ runSaga ,
275+ ) ;
276+
277+ expect ( await getUnlockPromise ( true ) ) . toBeUndefined ( ) ;
278+
279+ await close ( ) ;
280+ } ) ;
281+
282+ it ( 'returns the `getIsLocked` hook' , async ( ) => {
283+ const { snapId, close } = await getMockServer ( {
284+ manifest : getSnapManifest ( ) ,
285+ } ) ;
286+
287+ const location = detectSnapLocation ( snapId , {
288+ allowLocal : true ,
289+ } ) ;
290+
291+ const snapFiles = await fetchSnap ( snapId , location ) ;
292+
293+ const { getIsLocked } = getPermittedHooks (
294+ snapId ,
295+ snapFiles ,
296+ controllerMessenger ,
297+ runSaga ,
298+ ) ;
299+
300+ expect ( getIsLocked ( ) ) . toBe ( false ) ;
301+
302+ await close ( ) ;
303+ } ) ;
304+
236305 it ( 'returns the `getSnapFile` hook' , async ( ) => {
237306 const value = JSON . stringify ( { bar : 'baz' } ) ;
238307 const { snapId, close } = await getMockServer ( {
0 commit comments