Merge pull request #925 from LukeSchlangen/fix/rounding-numbers

round numbers but break tests
This commit is contained in:
Paul Kaplan 2018-02-08 08:59:54 -05:00 committed by GitHub
commit 8d42db7df8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 1 deletions

View file

@ -1,5 +1,6 @@
const test = require('tap').test;
const Looks = require('../../src/blocks/scratch3_looks');
const Runtime = require('../../src/engine/runtime');
const util = {
target: {
currentCostume: 0, // Internally, current costume is 0 indexed
@ -50,3 +51,20 @@ test('getBackdropNumberName can return costume name', t => {
t.strictEqual(number, 'third name');
t.end();
});
test('numbers should be rounded to two decimals in say', t => {
const rt = new Runtime();
const looks = new Looks(rt);
const args = {MESSAGE: 3.14159};
const expectedSayString = '3.14';
rt.removeAllListeners('SAY'); // Prevent say blocks from executing
rt.addListener('SAY', (target, type, sayString) => {
t.strictEqual(sayString, expectedSayString);
t.end();
});
looks.say(args, util);
});