Capture expected warning in registry test. (#4201)

This commit is contained in:
Monica Kozbial
2020-08-20 13:57:21 -07:00
committed by GitHub
parent f849f8801d
commit 6e39d2f2e2

View File

@@ -84,8 +84,13 @@ suite('Registry', function() {
});
test('Incorrect Plugin Name', function() {
this.options['plugins']['test'] = 'random';
var testClass = Blockly.registry.getClassFromOptions('test', this.options);
var testClass;
var warnings = captureWarnings(() => {
testClass = Blockly.registry.getClassFromOptions('test', this.options);
});
chai.assert.isNull(testClass);
chai.assert.equal(warnings.length, 1,
'Expecting 1 warning about no name "random" found.');
});
});
});