@@ -12,17 +12,18 @@ test('serializeAssets serialization order', t => {
12
12
const vm = new VM ( ) ;
13
13
vm . attachStorage ( makeTestStorage ( ) ) ;
14
14
vm . loadProject ( fixture ) . then ( ( ) => {
15
- const assets = vm . serializeAssets ( ) ;
16
- for ( let i = 0 ; i < assets . length ; i ++ ) {
17
- // won't deduplicate assets, so expecting 8 costumes, 7 sounds
18
- // 8 costumes, 6 sounds
19
- if ( i < 8 ) {
20
- t . ok ( assets [ i ] . fileName . endsWith ( '.svg' ) , `file ${ i + 1 } is costume` ) ;
21
- } else {
22
- t . ok ( assets [ i ] . fileName . endsWith ( '.wav' ) , `file ${ i + 1 } is sound` ) ;
15
+ vm . serializeAssets ( ) . then ( assets => {
16
+ for ( let i = 0 ; i < assets . length ; i ++ ) {
17
+ // won't deduplicate assets, so expecting 8 costumes, 7 sounds
18
+ // 8 costumes, 6 sounds
19
+ if ( i < 8 ) {
20
+ t . ok ( assets [ i ] . fileName . endsWith ( '.svg' ) , `file ${ i + 1 } is costume` ) ;
21
+ } else {
22
+ t . ok ( assets [ i ] . fileName . endsWith ( '.wav' ) , `file ${ i + 1 } is sound` ) ;
23
+ }
23
24
}
24
- }
25
- t . end ( ) ;
25
+ t . end ( ) ;
26
+ } ) ;
26
27
} ) ;
27
28
} ) ;
28
29
@@ -79,20 +80,21 @@ test('saveProjectSb3DontZip', t => {
79
80
const vm = new VM ( ) ;
80
81
vm . attachStorage ( makeTestStorage ( ) ) ;
81
82
vm . loadProject ( fixture ) . then ( ( ) => {
82
- const exported = vm . saveProjectSb3DontZip ( ) ;
83
- const files = Object . keys ( exported ) ;
84
-
85
- for ( let i = 0 ; i < files . length ; i ++ ) {
86
- // 6 costumes, 6 sounds
87
- if ( i === 0 ) {
88
- t . equal ( files [ i ] , 'project.json' , 'first file is project.json' ) ;
89
- } else if ( i < 7 ) {
90
- t . ok ( files [ i ] . endsWith ( '.svg' ) , `file ${ i + 1 } is costume` ) ;
91
- } else {
92
- t . ok ( files [ i ] . endsWith ( '.wav' ) , `file ${ i + 1 } is sound` ) ;
83
+ vm . saveProjectSb3DontZip ( ) . then ( exported => {
84
+ const files = Object . keys ( exported ) ;
85
+
86
+ for ( let i = 0 ; i < files . length ; i ++ ) {
87
+ // 6 costumes, 6 sounds
88
+ if ( i === 0 ) {
89
+ t . equal ( files [ i ] , 'project.json' , 'first file is project.json' ) ;
90
+ } else if ( i < 7 ) {
91
+ t . ok ( files [ i ] . endsWith ( '.svg' ) , `file ${ i + 1 } is costume` ) ;
92
+ } else {
93
+ t . ok ( files [ i ] . endsWith ( '.wav' ) , `file ${ i + 1 } is sound` ) ;
94
+ }
93
95
}
94
- }
95
-
96
- t . end ( ) ;
96
+
97
+ t . end ( ) ;
98
+ } ) ;
97
99
} ) ;
98
100
} ) ;
0 commit comments