mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-10 21:39:57 -04:00
Fix pen tests
This commit is contained in:
parent
dd20e09774
commit
b6727a766f
4 changed files with 47 additions and 20 deletions
test/integration
|
@ -1,8 +1,10 @@
|
|||
const Worker = require('tiny-worker');
|
||||
const path = require('path');
|
||||
const test = require('tap').test;
|
||||
|
||||
const Scratch3PenBlocks = require('../../src/blocks/scratch3_pen');
|
||||
const VirtualMachine = require('../../src/index');
|
||||
const dispatch = require('../../src/dispatch/central-dispatch');
|
||||
|
||||
const makeTestStorage = require('../fixtures/make-test-storage');
|
||||
const extract = require('../fixtures/extract');
|
||||
|
@ -10,6 +12,9 @@ const extract = require('../fixtures/extract');
|
|||
const uri = path.resolve(__dirname, '../fixtures/pen.sb2');
|
||||
const project = extract(uri);
|
||||
|
||||
// By default Central Dispatch works with the Worker class built into the browser. Tell it to use TinyWorker instead.
|
||||
dispatch.workerClass = Worker;
|
||||
|
||||
test('pen', t => {
|
||||
const vm = new VirtualMachine();
|
||||
vm.attachStorage(makeTestStorage());
|
||||
|
@ -42,14 +47,16 @@ test('pen', t => {
|
|||
vm.clear();
|
||||
vm.setCompatibilityMode(false);
|
||||
vm.setTurboMode(false);
|
||||
vm.loadProject(project).then(() => {
|
||||
vm.greenFlag();
|
||||
vm.loadProject(project)
|
||||
.then(() => vm.extensionManager.loadExtensionURL('pen')) /** @TODO: loadProject should load extensions */
|
||||
.then(() => {
|
||||
vm.greenFlag();
|
||||
|
||||
// After two seconds, get playground data and stop
|
||||
setTimeout(() => {
|
||||
vm.getPlaygroundData();
|
||||
vm.stopAll();
|
||||
}, 2000);
|
||||
});
|
||||
// After two seconds, get playground data and stop
|
||||
setTimeout(() => {
|
||||
vm.getPlaygroundData();
|
||||
vm.stopAll();
|
||||
}, 2000);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue