Minor stub and assert cleanup (#4185)

* Fix order or assert equal arguments.

* Replace usages of callsFake with returns where appropriate
This commit is contained in:
Monica Kozbial
2020-08-20 11:07:32 -07:00
committed by GitHub
parent c13880d4d0
commit f849f8801d
3 changed files with 4 additions and 10 deletions

View File

@@ -199,14 +199,10 @@ suite('Connection Database', function() {
setup(function() {
// Ignore type checks.
sinon.stub(this.database.connectionChecker_, 'doTypeChecks')
.callsFake(function(_a, _b) {
return true;
});
.returns(true);
// Ignore safety checks.
sinon.stub(this.database.connectionChecker_, 'doSafetyChecks')
.callsFake(function(_a, _b) {
return Blockly.Connection.CAN_CONNECT;
});
.returns(Blockly.Connection.CAN_CONNECT);
// Skip everything but the distance checks.
sinon.stub(this.database.connectionChecker_, 'doDragChecks')
.callsFake(function(a, b, distance) {

View File

@@ -730,7 +730,7 @@ suite('Events', function() {
// The first varCreate and move event should have been ignored.
sinon.assert.callCount(this.changeListenerSpy, 3);
// Expect two events on undo stack: varCreate and block create.
chai.assert.equal(2, this.workspace.undoStack_.length,
chai.assert.equal(this.workspace.undoStack_.length, 2,
'Undo stack length');
assertNthCallEventArgEquals(

View File

@@ -395,9 +395,7 @@ suite('Navigation', function() {
var block = this.workspace.getTopBlocks()[0];
var field = block.inputList[0].fieldRow[0];
sinon.stub(field, 'onBlocklyAction').callsFake(function(){
return true;
});
sinon.stub(field, 'onBlocklyAction').returns(true);
this.workspace.getCursor().setCurNode(Blockly.ASTNode.createFieldNode(field));
var isHandled = Blockly.navigation.onBlocklyAction(Blockly.navigation.ACTION_OUT);