mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-07-11 05:24:05 -04:00
Add a test and fix for not serializing top-level variable reporters
This commit is contained in:
parent
122443a75f
commit
be65b615a2
3 changed files with 15 additions and 1 deletions
test/unit
|
@ -7,6 +7,7 @@ const exampleProjectPath = path.resolve(__dirname, '../fixtures/clone-cleanup.sb
|
|||
const commentsSB2ProjectPath = path.resolve(__dirname, '../fixtures/comments.sb2');
|
||||
const commentsSB3ProjectPath = path.resolve(__dirname, '../fixtures/comments.sb3');
|
||||
const commentsSB3NoDupeIds = path.resolve(__dirname, '../fixtures/comments_no_duplicate_id_serialization.sb3');
|
||||
const variableReporterSB2ProjectPath = path.resolve(__dirname, '../fixtures/top-level-variable-reporter.sb2');
|
||||
const FakeRenderer = require('../fixtures/fake-renderer');
|
||||
|
||||
test('serialize', t => {
|
||||
|
@ -236,3 +237,16 @@ test('getExtensionIdForOpcode', t => {
|
|||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('(#1608) serializeBlocks maintains top level variable reporters', t => {
|
||||
const vm = new VirtualMachine();
|
||||
vm.loadProject(readFileToBuffer(variableReporterSB2ProjectPath))
|
||||
.then(() => {
|
||||
const blocks = vm.runtime.targets[0].blocks._blocks;
|
||||
const result = sb3.serialize(vm.runtime).targets[0].blocks;
|
||||
// Project should have 1 block, a top-level variable reporter
|
||||
t.equal(Object.keys(blocks).length, 1);
|
||||
t.equal(Object.keys(result).length, 1);
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue