Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 094580c

Browse files
hsablonnierepetebacondarwin
authored andcommitted
fix(scenario): include "not " in error messages if test is inverted
Closes #3840
1 parent cc4d08c commit 094580c

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/ngScenario/Scenario.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,16 @@ angular.scenario.dsl = angular.scenario.dsl || function(name, fn) {
6969
*/
7070
angular.scenario.matcher = angular.scenario.matcher || function(name, fn) {
7171
angular.scenario.matcher[name] = function(expected) {
72-
var prefix = 'expect ' + this.future.name + ' ';
73-
if (this.inverse) {
74-
prefix += 'not ';
75-
}
72+
var prefix = 'expect ' + this.future.name + ' ',
73+
not = this.inverse && 'not ';
7674
var self = this;
77-
this.addFuture(prefix + name + ' ' + angular.toJson(expected),
75+
this.addFuture(prefix + not + name + ' ' + angular.toJson(expected),
7876
function(done) {
7977
var error;
8078
self.actual = self.future.value;
8179
if ((self.inverse && fn.call(self, expected)) ||
8280
(!self.inverse && !fn.call(self, expected))) {
83-
error = 'expected ' + angular.toJson(expected) +
81+
error = 'expected ' + not + name + ' ' + angular.toJson(expected) +
8482
' but was ' + angular.toJson(self.actual);
8583
}
8684
done(error);

0 commit comments

Comments
 (0)