Add tests for converting extension metadata

These tests convert some extension metadata into scratch-blocks JSON and
XML, then verify that the JSON and XML are as expected.
This commit is contained in:
Christopher Willis-Ford 2018-04-09 15:34:46 -07:00
parent 8ef4aec7fa
commit 53b5ba93f5
5 changed files with 206 additions and 35 deletions
src/engine

View file

@ -5,10 +5,11 @@ const escapeHtml = require('escape-html');
const ArgumentType = require('../extension-support/argument-type');
const Blocks = require('./blocks');
const BlockType = require('../extension-support/block-type');
const Profiler = require('./profiler');
const Sequencer = require('./sequencer');
const ScratchBlocksConstants = require('./scratch-blocks-constants');
const TargetType = require('../extension-support/target-type');
const Thread = require('./thread');
const Profiler = require('./profiler');
const log = require('../util/log');
const maybeFormatMessage = require('../util/maybe-format-message');
@ -68,32 +69,6 @@ const ConvertedSeparator = {
xml: '<sep gap="36"/>'
};
/**
* These constants are copied from scratch-blocks/core/constants.js
* @TODO find a way to require() these... maybe make a scratch-blocks/dist/constants.js or something like that?
* @readonly
* @enum {int}
*/
const ScratchBlocksConstants = {
/**
* ENUM for output shape: hexagonal (booleans/predicates).
* @const
*/
OUTPUT_SHAPE_HEXAGONAL: 1,
/**
* ENUM for output shape: rounded (numbers).
* @const
*/
OUTPUT_SHAPE_ROUND: 2,
/**
* ENUM for output shape: squared (any/all values; strings).
* @const
*/
OUTPUT_SHAPE_SQUARE: 3
};
/**
* Numeric ID for Runtime._step in Profiler instances.
* @type {number}