More work on connection type checks

This commit is contained in:
Rachel Fenichel
2020-07-14 13:49:58 -06:00
parent bb8348befd
commit 450aed0aa2
6 changed files with 163 additions and 139 deletions

View File

@@ -229,13 +229,12 @@ suite('Connection type checker', function() {
this.con2 = new Blockly.Connection({}, Blockly.NEXT_STATEMENT);
});
function assertCheckTypes(checker, one, two) {
chai.assert.isTrue(checker.checkType(one, two));
chai.assert.isTrue(checker.passesTypeChecks(one, two));
// Order should not matter.
chai.assert.isTrue(checker.checkType(one, two));
chai.assert.isTrue(checker.passesTypeChecks(one, two));
}
test('No Types', function() {
assertCheckTypes(this.checker, this.con1, this.con2);
chai.assert.isTrue(this.checker.checkType(this.con1, this.con2));
});
test('Same Type', function() {
this.con1.setCheck('type1');
@@ -259,7 +258,7 @@ suite('Connection type checker', function() {
test('No Compatible Types', function() {
this.con1.setCheck('type1');
this.con2.setCheck('type2');
chai.assert.isFalse(this.checker.checkType(this.con1, this.con2));
chai.assert.isFalse(this.checker.passesTypeChecks(this.con1, this.con2));
});
});
});