diff --git a/tests/mocha/test_helpers/block_test_helpers.mocha.js b/tests/mocha/test_helpers/block_test_helpers.mocha.js index 73a52c986..a8f77a8ca 100644 --- a/tests/mocha/test_helpers/block_test_helpers.mocha.js +++ b/tests/mocha/test_helpers/block_test_helpers.mocha.js @@ -126,11 +126,11 @@ const createCodeGenerationTestFn_ = (generator) => { } } const assertFunc = (typeof testCase.expectedCode === 'string') ? - assert.equal : assert.match; + chai.assert.equal : chai.assert.match; assertFunc(code, testCase.expectedCode); if (!testCase.useWorkspaceToCode && testCase.expectedInnerOrder !== undefined) { - assert.equal(innerOrder, testCase.expectedInnerOrder); + chai.assert.equal(innerOrder, testCase.expectedInnerOrder); } }; }; @@ -190,7 +190,7 @@ const runSerializationTestSuite = (testCases) => { testCase.json, this.workspace); const generatedJson = Blockly.serialization.blocks.save(block); const expectedJson = testCase.expectedJson || testCase.json; - assert.deepEqual(generatedJson, expectedJson); + chai.assert.deepEqual(generatedJson, expectedJson); } else { const block = Blockly.Xml.domToBlock(Blockly.Xml.textToDom( testCase.xml), this.workspace); @@ -198,7 +198,7 @@ const runSerializationTestSuite = (testCases) => { Blockly.Xml.domToPrettyText( Blockly.Xml.blockToDom(block)); const expectedXml = testCase.expectedXml || testCase.xml; - assert.equal(generatedXml, expectedXml); + chai.assert.equal(generatedXml, expectedXml); } }; }; diff --git a/tests/mocha/test_helpers/field_test_helpers.mocha.js b/tests/mocha/test_helpers/field_test_helpers.mocha.js index f99a30b8c..fda26b150 100644 --- a/tests/mocha/test_helpers/field_test_helpers.mocha.js +++ b/tests/mocha/test_helpers/field_test_helpers.mocha.js @@ -75,9 +75,10 @@ function assertFieldValue(field, expectedValue, expectedText = undefined) { if (expectedText === undefined) { expectedText = String(expectedValue); } - assert.equal(actualValue, expectedValue, 'Value'); - assert.equal(actualText, expectedText, 'Text'); + chai.assert.equal(actualValue, expectedValue, 'Value'); + chai.assert.equal(actualText, expectedText, 'Text'); } +exports.assertFieldValue = assertFieldValue; /** * Runs provided creation test cases. @@ -120,7 +121,7 @@ function runCreationTestsAssertThrows_(testCases, creation) { */ const createTestFn = (testCase) => { return function() { - assert.throws(function() { + chai.assert.throws(function() { creation.call(this, testCase); }, testCase.errMsgMatcher); }; @@ -156,7 +157,7 @@ function runConstructorSuiteTests(TestedField, validValueTestCases, }); } else { test('Empty', function() { - assert.throws(function() { + chai.assert.throws(function() { customCreateWithJs ? customCreateWithJs.call(this) : new TestedField(); }); @@ -211,7 +212,7 @@ function runFromJsonSuiteTests(TestedField, validValueTestCases, }); } else { test('Empty', function() { - assert.throws(function() { + chai.assert.throws(function() { customCreateWithJson ? customCreateWithJson.call(this) : TestedField.fromJson({}); }); diff --git a/tests/node/run_node_test.js b/tests/node/run_node_test.js index 69d095d51..c0c428c0c 100644 --- a/tests/node/run_node_test.js +++ b/tests/node/run_node_test.js @@ -38,7 +38,7 @@ suite('Test Node.js', function() { const headlessXml = Blockly.Xml.workspaceToDom(workspace, true); const headlessText = Blockly.Xml.domToPrettyText(headlessXml); - assert.equal(headlessText, xmlText, 'equal'); + chai.assert.equal(headlessText, xmlText, 'equal'); }); test('Generate Code', function() { const xml = Blockly.Xml.textToDom(xmlText); @@ -51,7 +51,7 @@ suite('Test Node.js', function() { const code = Blockly.JavaScript.workspaceToCode(workspace); // Check output - assert.equal('window.alert(\'Hello from Blockly!\');', code.trim(), 'equal'); + chai.assert.equal('window.alert(\'Hello from Blockly!\');', code.trim(), 'equal'); }); });