File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
packages/multichain-account-service/src/snaps Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -121,15 +121,24 @@ describe('SnapPlatformWatcher', () => {
121121 const { rootMessenger, messenger } = setup ( ) ;
122122 const watcher = new SnapPlatformWatcher ( messenger ) ;
123123
124+ // Make platform ready
124125 publishIsReadyState ( rootMessenger , true ) ;
126+
127+ // Should work
125128 expect ( await watcher . ensureCanUseSnapPlatform ( ) ) . toBeUndefined ( ) ;
126129
130+ // Make platform unavailable.
127131 publishIsReadyState ( rootMessenger , false ) ;
132+
133+ // Should fail.
128134 await expect ( watcher . ensureCanUseSnapPlatform ( ) ) . rejects . toThrow (
129135 'Snap platform cannot be used now.' ,
130136 ) ;
131137
138+ // Make platform ready again.
132139 publishIsReadyState ( rootMessenger , true ) ;
140+
141+ // Should work again.
133142 expect ( await watcher . ensureCanUseSnapPlatform ( ) ) . toBeUndefined ( ) ;
134143 } ) ;
135144
@@ -215,6 +224,7 @@ describe('SnapPlatformWatcher', () => {
215224 it ( 'resolves immediately if platform is already ready' , async ( ) => {
216225 const { messenger, mocks } = setup ( ) ;
217226
227+ // Make the platform ready before creating the watcher.
218228 mocks . SnapController . getState . mockReturnValue ( {
219229 isReady : true ,
220230 } as SnapControllerState ) ;
You can’t perform that action at this time.
0 commit comments