Fix tests & a typo

This commit is contained in:
Christopher Willis-Ford 2017-11-03 11:42:20 -07:00
parent 0af3de9bf0
commit c88a8fa55a
5 changed files with 7 additions and 7 deletions

View file

@ -74,7 +74,7 @@ const parseScratchObject = function (object, runtime, extensions) {
}
if (object.hasOwnProperty('blocks')) {
for (const blockId in object.blocks) {
const blockJSON = object.blockType[blockId];
const blockJSON = object.blocks[blockId];
blocks.createBlock(blockJSON);
const dotIndex = blockJSON.opcode.indexOf('.');

View file

@ -21,7 +21,7 @@ test('default', t => {
// Create runtime instance & load SB2 into it
const rt = new runtime();
rt.attachStorage(makeTestStorage());
sb2.deserialize(json, rt).then(targets => {
sb2.deserialize(json, rt).then(({targets}) => {
// Test
t.type(file, 'string');
t.type(json, 'object');

View file

@ -103,7 +103,7 @@ test('sb3-roundtrip', t => {
return sb3.deserialize(serializedState, runtime2);
});
return serializeAndDeserialize.then(targets => {
return serializeAndDeserialize.then(({targets}) => {
runtime2.targets = targets;
testRuntimeState('copy', runtime2);
});

View file

@ -20,7 +20,7 @@ test('default', t => {
// Create runtime instance & load SB2 into it
const rt = new Runtime();
sb2.deserialize(json, rt).then(targets => {
sb2.deserialize(json, rt).then(({targets}) => {
// Test
t.type(file, 'string');
t.type(json, 'object');
@ -60,7 +60,7 @@ test('data scoping', t => {
// Create runtime instance & load SB2 into it
const rt = new Runtime();
sb2.deserialize(json, rt).then(targets => {
sb2.deserialize(json, rt).then(({targets}) => {
const globalVariableIds = Object.keys(targets[0].variables);
const localVariableIds = Object.keys(targets[1].variables);
t.equal(targets[0].variables[globalVariableIds[0]].name, 'foo');

View file

@ -14,8 +14,8 @@ test('serialize', t => {
test('deserialize', t => {
const vm = new VirtualMachine();
sb3.deserialize('', vm.runtime).then(targets => {
// @todo Analyize
sb3.deserialize('', vm.runtime).then(({targets}) => {
// @todo Analyze
t.type(targets, 'object');
t.end();
});