2017-04-26 16:50:53 -04:00
|
|
|
const test = require('tap').test;
|
|
|
|
const VirtualMachine = require('../../src/index');
|
|
|
|
const sb3 = require('../../src/serialization/sb3');
|
2017-04-27 17:49:57 -04:00
|
|
|
const demoSb3 = require('../fixtures/demo.json');
|
2016-12-30 10:19:58 -05:00
|
|
|
|
2017-04-26 16:50:53 -04:00
|
|
|
test('serialize', t => {
|
|
|
|
const vm = new VirtualMachine();
|
2018-03-21 17:55:02 -04:00
|
|
|
vm.loadProject(JSON.stringify(demoSb3))
|
2018-03-16 11:43:27 -04:00
|
|
|
.then(() => {
|
|
|
|
const result = sb3.serialize(vm.runtime);
|
|
|
|
// @todo Analyze
|
|
|
|
t.type(JSON.stringify(result), 'string');
|
|
|
|
t.end();
|
|
|
|
});
|
2016-12-30 10:19:58 -05:00
|
|
|
});
|
|
|
|
|
2017-04-26 16:50:53 -04:00
|
|
|
test('deserialize', t => {
|
|
|
|
const vm = new VirtualMachine();
|
2017-11-03 14:42:20 -04:00
|
|
|
sb3.deserialize('', vm.runtime).then(({targets}) => {
|
|
|
|
// @todo Analyze
|
2017-04-27 17:49:57 -04:00
|
|
|
t.type(targets, 'object');
|
|
|
|
t.end();
|
|
|
|
});
|
2016-12-30 10:19:58 -05:00
|
|
|
});
|