mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-17 16:59:43 -04:00
Build out integration test SB2 files
This commit is contained in:
parent
b8af7c0723
commit
dfc6614a5b
16 changed files with 122 additions and 304 deletions
test/integration
34
test/integration/control.js
Normal file
34
test/integration/control.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
var test = require('tap').test;
|
||||
var extract = require('../fixtures/extract');
|
||||
var VirtualMachine = require('../../src/index');
|
||||
|
||||
var path = __dirname + '/../fixtures/control.sb2';
|
||||
var project = extract(path);
|
||||
|
||||
test('control project', function (t) {
|
||||
var vm = new VirtualMachine();
|
||||
|
||||
// Evaluate playground data and exit
|
||||
vm.on('playgroundData', function (e) {
|
||||
var threads = JSON.parse(e.threads);
|
||||
t.ok(threads.length > 0);
|
||||
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);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue