Update captureWarnings usages to assertWarnings

This commit is contained in:
kozbial
2021-09-22 17:14:41 -07:00
committed by Monica Kozbial
parent d7d74f4fba
commit 4efdd72a24
2 changed files with 7 additions and 13 deletions

View File

@@ -257,12 +257,10 @@ suite('Registry', function() {
test('Incorrect Plugin Name', function() {
this.options['plugins']['test'] = 'random';
var testClass;
var warnings = testHelpers.captureWarnings(() => {
assertWarnings(() => {
testClass = Blockly.registry.getClassFromOptions('test', this.options);
});
}, /Unable to find/);
chai.assert.isNull(testClass);
chai.assert.equal(warnings.length, 1,
'Expecting 1 warning about no name "random" found.');
});
});
});

View File

@@ -6,7 +6,7 @@
goog.module('Blockly.test.workspaceHelpers');
const {assertVariableValues, workspaceTeardown} = goog.require('Blockly.test.helpers');
const {assertVariableValues, assertWarnings, workspaceTeardown} = goog.require('Blockly.test.helpers');
function testAWorkspace() {
@@ -1294,11 +1294,9 @@ function testAWorkspace() {
this.workspace.createVariable('name1', 'type1', 'id1');
this.workspace.deleteVariableById('id1');
var workspace = this.workspace;
var warnings = testHelpers.captureWarnings(function() {
assertWarnings(() => {
workspace.deleteVariableById('id1');
});
chai.assert.equal(warnings.length, 1,
'Expected 1 warning for second deleteVariableById call.');
}, /Can't delete/);
// Check the undoStack only recorded one delete event.
var undoStack = this.workspace.undoStack_;
@@ -1323,11 +1321,9 @@ function testAWorkspace() {
createVarBlocksNoEvents(this.workspace, ['id1']);
this.workspace.deleteVariableById('id1');
var workspace = this.workspace;
var warnings = testHelpers.captureWarnings(function() {
assertWarnings(() => {
workspace.deleteVariableById('id1');
});
chai.assert.equal(warnings.length, 1,
'Expected 1 warning for second deleteVariableById call.');
}, /Can't delete/);
// Check the undoStack only recorded one delete event.
var undoStack = this.workspace.undoStack_;