2016-12-23 14:09:35 -05:00
|
|
|
var test = require('tap').test;
|
2016-12-23 21:08:13 -05:00
|
|
|
var extract = require('../fixtures/extract');
|
2016-12-23 14:09:35 -05:00
|
|
|
var VirtualMachine = require('../../src/index');
|
|
|
|
|
2016-12-23 21:08:13 -05:00
|
|
|
var path = __dirname + '/../fixtures/data.sb2';
|
|
|
|
var project = extract(path);
|
2016-12-23 14:09:35 -05:00
|
|
|
|
2016-12-23 21:08:13 -05:00
|
|
|
test('data project', function (t) {
|
2016-12-23 14:09:35 -05:00
|
|
|
var vm = new VirtualMachine();
|
|
|
|
|
|
|
|
// Evaluate playground data and exit
|
2016-12-23 21:08:13 -05:00
|
|
|
vm.on('playgroundData', function () {
|
|
|
|
// @todo Additional tests
|
2016-12-23 14:09:35 -05:00
|
|
|
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);
|
2016-12-23 21:08:13 -05:00
|
|
|
vm.loadProject(project);
|
2016-12-23 14:09:35 -05:00
|
|
|
vm.greenFlag();
|
|
|
|
});
|
|
|
|
|
|
|
|
// After two seconds, get playground data and stop
|
|
|
|
setTimeout(function () {
|
|
|
|
vm.getPlaygroundData();
|
|
|
|
vm.stopAll();
|
|
|
|
}, 2000);
|
|
|
|
});
|