Modify saveProjectSb3DontZip asset order to match saveProjectSb3

This commit is contained in:
Muffin committed 2023-07-31 22:37:16 -05:00
1 parent 4631dfc6a7
commit a1d2cd108a
2 files changed
+24 -1

No files matched your search

+1 -1
View File
@@ -551,7 +551,7 @@ class VirtualMachine extends EventEmitter {
const files = {
'project.json': new _TextEncoder().encode(projectJson)
};
for (const fileDesc of soundDescs.concat(costumeDescs)) {
for (const fileDesc of costumeDescs.concat(soundDescs)) {
files[fileDesc.fileName] = fileDesc.fileContent;
}
@@ -54,3 +54,26 @@ test('exportSprite serialization order', t => {
});
});
});
test('saveProjectSb3DontZip', t => {
t.plan(13);
const vm = new VM();
vm.attachStorage(makeTestStorage());
vm.loadProject(fixture).then(() => {
const exported = vm.saveProjectSb3DontZip();
const files = Object.keys(exported);
for (let i = 0; i < files.length; i++) {
// 6 costumes, 6 sounds
if (i === 0) {
t.equal(files[i], 'project.json', 'first file is project.json');
} else if (i < 7) {
t.ok(files[i].endsWith('.svg'), `file ${i + 1} is costume`);
} else {
t.ok(files[i].endsWith('.wav'), `file ${i + 1} is sound`);
}
}
t.end();
});
});