Skip to content

Commit

Permalink
eql(): fix wrong order of actual vs. expected.
Browse files Browse the repository at this point in the history
The helper `expect.eql()` function, like typical assertion methods,
takes `actual` then `expected`:

https://github.com/LearnBoost/expect.js/blob/master/expect.js#L850

But the `Assertion.prototype.eql` wrapper has been incorrectly
passing `this.obj` (the object being tested) as the `expected`, and
vice versa passing `obj` (the object used for comparison) as the
`actual`. This fixes that.
  • Loading branch information
aseemk committed May 25, 2013
1 parent 5a1e44c commit 7c20523
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions expect.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

(function (global, module) {

if ('undefined' == typeof module) {
Expand Down Expand Up @@ -212,7 +211,7 @@

Assertion.prototype.eql = function (obj) {
this.assert(
expect.eql(obj, this.obj)
expect.eql(this.obj, obj)
, function(){ return 'expected ' + i(this.obj) + ' to sort of equal ' + i(obj) }
, function(){ return 'expected ' + i(this.obj) + ' to sort of not equal ' + i(obj) });
return this;
Expand Down

0 comments on commit 7c20523

Please sign in to comment.