mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-01-10 15:02:06 -05:00
Test the info
field in converted extension data
There are parts of the extension registration process which rely on the `info` field being non-null, even for block separators. At one point during development I broke that, so here's a test to hopefully prevent someone else from getting bitten by the same thing.
This commit is contained in:
parent
4cdbb26f57
commit
0162bfc71e
1 changed files with 5 additions and 0 deletions
|
@ -163,6 +163,11 @@ test('registerExtensionPrimitives', t => {
|
||||||
runtime.on(Runtime.EXTENSION_ADDED, blocksInfo => {
|
runtime.on(Runtime.EXTENSION_ADDED, blocksInfo => {
|
||||||
t.equal(blocksInfo.length, testExtensionInfo.blocks.length);
|
t.equal(blocksInfo.length, testExtensionInfo.blocks.length);
|
||||||
|
|
||||||
|
blocksInfo.forEach(blockInfo => {
|
||||||
|
// `true` here means "either an object or a non-empty string but definitely not null or undefined"
|
||||||
|
t.true(blockInfo.info, 'Every block and pseudo-block must have a non-empty "info" field');
|
||||||
|
});
|
||||||
|
|
||||||
// Note that this also implicitly tests that block order is preserved
|
// Note that this also implicitly tests that block order is preserved
|
||||||
const [button, reporter, separator, command, conditional, loop] = blocksInfo;
|
const [button, reporter, separator, command, conditional, loop] = blocksInfo;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue