mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-25 07:22:33 -05:00
e4fd9d57a2
- Attach the storage module to the VM for tests which load projects or other assets. - Move `import_sb2.js` from `test/unit/ into `test/integration` since it now depends heavily on `scratch-storage`. - Skip loading costumes when there is no renderer.
36 lines
992 B
JavaScript
36 lines
992 B
JavaScript
var path = require('path');
|
|
var test = require('tap').test;
|
|
var attachTestStorage = require('../fixtures/attach-test-storage');
|
|
var extract = require('../fixtures/extract');
|
|
var VirtualMachine = require('../../src/index');
|
|
|
|
var uri = path.resolve(__dirname, '../fixtures/data.sb2');
|
|
var project = extract(uri);
|
|
|
|
test('data', function (t) {
|
|
var vm = new VirtualMachine();
|
|
attachTestStorage(vm);
|
|
|
|
// Evaluate playground data and exit
|
|
vm.on('playgroundData', function () {
|
|
// @todo Additional tests
|
|
t.end();
|
|
process.nextTick(process.exit);
|
|
});
|
|
|
|
// Start VM, load project, and run
|
|
t.doesNotThrow(function () {
|
|
vm.start();
|
|
vm.clear();
|
|
vm.setCompatibilityMode(false);
|
|
vm.setTurboMode(false);
|
|
vm.loadProject(project);
|
|
vm.greenFlag();
|
|
});
|
|
|
|
// After two seconds, get playground data and stop
|
|
setTimeout(function () {
|
|
vm.getPlaygroundData();
|
|
vm.stopAll();
|
|
}, 2000);
|
|
});
|