Write download-project tests
This commit is contained in:
5 files changed
+40
-1
No files matched your search
Generated
+7
-1
@@ -7887,6 +7887,12 @@
|
||||
"tslib": "^2.0.3"
|
||||
}
|
||||
},
|
||||
"node-blob": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "https://registry.npmjs.org/node-blob/-/node-blob-0.0.2.tgz",
|
||||
"integrity": "sha512-82wiGzMht96gPQDUYaZBdZEVvYD9aEhU6Bt9KLCr4rADZPRd7dQVY2Yj0ZG/1vp4DhVkL49nJT/M3CiMTAt3ag==",
|
||||
"dev": true
|
||||
},
|
||||
"node-fetch": {
|
||||
"version": "2.6.1",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
|
||||
@@ -9274,7 +9280,7 @@
|
||||
},
|
||||
"scratch-vm": {
|
||||
"version": "git://github.com/TurboWarp/scratch-vm.git#dbae5fe7d680c80fd59e244c86f4e55b4a41829c",
|
||||
"from": "git://github.com/TurboWarp/scratch-vm.git#dbae5fe7d680c80fd59e244c86f4e55b4a41829c",
|
||||
"from": "git://github.com/TurboWarp/scratch-vm.git#develop",
|
||||
"requires": {
|
||||
"@vernier/godirect": "1.5.0",
|
||||
"arraybuffer-loader": "^1.0.6",
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
"file-loader": "^6.2.0",
|
||||
"html-webpack-plugin": "^4.5.2",
|
||||
"jest": "^27.0.4",
|
||||
"node-blob": "0.0.2",
|
||||
"node-fetch": "^2.6.1",
|
||||
"style-loader": "^2.0.0",
|
||||
"svelte-loader": "^3.1.2",
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import Blob from 'node-blob';
|
||||
import downloadProject from '../../src/packager/lib/download-project'
|
||||
|
||||
global.Blob = Blob;
|
||||
|
||||
const emptyProgressCallback = () => {};
|
||||
|
||||
const readTestProject = (name) => {
|
||||
const buffer = fs.readFileSync(path.resolve(__dirname, 'projects', name));
|
||||
return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
|
||||
};
|
||||
|
||||
test('sb3', async () => {
|
||||
const project = await downloadProject(await readTestProject('no-music.sb3'), emptyProgressCallback);
|
||||
expect(project.type).toBe('sb3');
|
||||
expect(project.analysis.stageVariables['`jEk@4|i[#Fk?(8x)AV.-my variable']).toEqual({
|
||||
name: 'my variable',
|
||||
isCloud: false
|
||||
});
|
||||
expect(project.analysis.stageVariables['BHEUfE_ev.6Eib^2/3nu']).toEqual({
|
||||
name: '☁ Cloud variable',
|
||||
isCloud: true
|
||||
});
|
||||
expect(project.analysis.usesMusic).toBe(false);
|
||||
});
|
||||
|
||||
test('sb3 with music', async () => {
|
||||
const project = await downloadProject(await readTestProject('music.sb3'), emptyProgressCallback);
|
||||
expect(project.analysis.usesMusic).toBe(true);
|
||||
});
|
||||
Binary file not shown.
Binary file not shown.
Reference in new issue
Block a user