File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -20,14 +20,15 @@ describe('TextEditor', () => {
20
20
await atom . packages . activatePackage ( 'language-javascript' )
21
21
} )
22
22
23
- it ( 'generates unique ids for each editor' , ( ) => {
24
- // Deserialized editors are initialized with an id:
25
- new TextEditor ( { id : 0 } )
26
- new TextEditor ( { id : 1 } )
27
- new TextEditor ( { id : 2 } )
28
- // Initializing an editor without an id causes a new id to be generated:
29
- const generatedId = new TextEditor ( ) . id
30
- expect ( generatedId ) . toBe ( 3 )
23
+ it ( 'generates unique ids for each editor' , async ( ) => {
24
+ // Deserialized editors are initialized with the serialized id. We can
25
+ // initialize an editor with what we expect to be the next id:
26
+ const deserialized = new TextEditor ( { id : editor . id + 1 } )
27
+ expect ( deserialized . id ) . toEqual ( editor . id + 1 )
28
+
29
+ // The id generator should skip the id used up by the deserialized one:
30
+ const fresh = new TextEditor ( )
31
+ expect ( fresh . id ) . toNotEqual ( deserialized . id )
31
32
} )
32
33
33
34
describe ( 'when the editor is deserialized' , ( ) => {
You can’t perform that action at this time.
0 commit comments