Download test/integration/data.js from soiz1/s4s-vm: direct link, hf CLI and curl.
- Browser
- Download file 1.1 kB
-
https://huggingface.co/datasets/soiz1/s4s-vm/resolve/main/test/integration/data.js
- Command line
-
hf download hf://datasets/soiz1/s4s-vm/test/integration/data.js
-
curl -L -o data.js https://huggingface.co/datasets/soiz1/s4s-vm/resolve/main/test/integration/data.js
1.1 kB
| const path = require('path'); | |
| const test = require('tap').test; | |
| const makeTestStorage = require('../fixtures/make-test-storage'); | |
| const readFileToBuffer = require('../fixtures/readProjectFile').readFileToBuffer; | |
| const VirtualMachine = require('../../src/index'); | |
| const uri = path.resolve(__dirname, '../fixtures/data.sb2'); | |
| const project = readFileToBuffer(uri); | |
| test('data', t => { | |
| const vm = new VirtualMachine(); | |
| vm.attachStorage(makeTestStorage()); | |
| // Evaluate playground data and exit | |
| vm.on('playgroundData', () => { | |
| // @todo Additional tests | |
| t.end(); | |
| process.nextTick(process.exit); | |
| }); | |
| // Start VM, load project, and run | |
| t.doesNotThrow(() => { | |
| vm.start(); | |
| vm.clear(); | |
| vm.setCompatibilityMode(false); | |
| vm.setTurboMode(false); | |
| vm.loadProject(project).then(() => { | |
| vm.greenFlag(); | |
| // After two seconds, get playground data and stop | |
| setTimeout(() => { | |
| vm.getPlaygroundData(); | |
| vm.stopAll(); | |
| }, 2000); | |
| }); | |
| }); | |
| }); | |