diff --git a/test/fixtures/pen.sb2 b/test/fixtures/pen.sb2 new file mode 100644 index 000000000..ac4c780d7 Binary files /dev/null and b/test/fixtures/pen.sb2 differ diff --git a/test/integration/pen.js b/test/integration/pen.js new file mode 100644 index 000000000..8256e13cb --- /dev/null +++ b/test/integration/pen.js @@ -0,0 +1,34 @@ +var path = require('path'); +var test = require('tap').test; +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(); + + // 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); +});