scratch-vm/test/integration/pen.js

38 lines
1 KiB
JavaScript
Raw Normal View History

const path = require('path');
const test = require('tap').test;
const attachTestStorage = require('../fixtures/attach-test-storage');
const extract = require('../fixtures/extract');
const VirtualMachine = require('../../src/index');
const uri = path.resolve(__dirname, '../fixtures/pen.sb2');
const project = extract(uri);
test('pen', t => {
const vm = new VirtualMachine();
attachTestStorage(vm);
// Evaluate playground data and exit
vm.on('playgroundData', () => {
// @todo Additional tests
t.end();
process.nextTick(process.exit);
});
// Start VM, load project, and run
t.doesNotThrow(() => {
vm.start();
vm.clear();
vm.setCompatibilityMode(false);
vm.setTurboMode(false);
vm.loadProject(project).then(() => {
2017-04-18 11:55:38 -04:00
vm.greenFlag();
2017-04-18 11:55:38 -04:00
// After two seconds, get playground data and stop
setTimeout(() => {
2017-04-18 11:55:38 -04:00
vm.getPlaygroundData();
vm.stopAll();
}, 2000);
});
});
});