From 0162bfc71ec03dfe89a80c40b535f994fef2038c Mon Sep 17 00:00:00 2001 From: Christopher Willis-Ford Date: Wed, 3 Apr 2019 11:02:54 -0700 Subject: [PATCH] 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. --- test/unit/extension_conversion.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/unit/extension_conversion.js b/test/unit/extension_conversion.js index 7c85f1578..3a59c0a01 100644 --- a/test/unit/extension_conversion.js +++ b/test/unit/extension_conversion.js @@ -163,6 +163,11 @@ test('registerExtensionPrimitives', t => { runtime.on(Runtime.EXTENSION_ADDED, blocksInfo => { 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 const [button, reporter, separator, command, conditional, loop] = blocksInfo;