2017-01-19 18:58:00 -05:00
|
|
|
var path = require('path');
|
|
|
|
var test = require('tap').test;
|
2017-03-09 18:50:43 -05:00
|
|
|
var attachTestStorage = require('../fixtures/attach-test-storage');
|
2017-01-19 18:58:00 -05:00
|
|
|
var extract = require('../fixtures/extract');
|
|
|
|
var VirtualMachine = require('../../src/index');
|
|
|
|
|
|
|
|
var uri = path.resolve(__dirname, '../fixtures/pen.sb2');
|
|
|
|
var project = extract(uri);
|
|
|
|
|
|
|
|
test('pen', function (t) {
|
|
|
|
var vm = new VirtualMachine();
|
2017-03-09 18:50:43 -05:00
|
|
|
attachTestStorage(vm);
|
2017-01-19 18:58:00 -05:00
|
|
|
|
|
|
|
// 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);
|
|
|
|
});
|