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:
Christopher Willis-Ford 2019-04-03 11:02:54 -07:00
parent 4cdbb26f57
commit 0162bfc71e

View file

@ -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;