Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
80 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
"use strict"; | ||
|
||
var deepEqualCyclic = require("./deep-equal"); | ||
var identical = require("./identical"); | ||
var isArguments = require("./is-arguments"); | ||
var isElement = require("./is-element"); | ||
var isNegZero = require("./is-neg-zero"); | ||
var match = require("./match"); | ||
var deepEqualCyclic = require("./deep-equal").use(match); | ||
var createMatcher = require("./sinon-match"); | ||
|
||
module.exports = { | ||
isArguments: isArguments, | ||
isElement: isElement, | ||
isNegZero: isNegZero, | ||
identical: identical, | ||
deepEqual: deepEqualCyclic, | ||
match: match | ||
match: match, | ||
createMatcher: createMatcher | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
"use strict"; | ||
|
||
var assert = require("@sinonjs/referee").assert; | ||
var samsam = require("./samsam"); | ||
var match = samsam.match; | ||
|
||
describe("sinon-match-integration", function() { | ||
context("samsam.match", function() { | ||
it("returns true if matching custom matcher", function() { | ||
var matchAlways = samsam.createMatcher(function() { | ||
return true; | ||
}); | ||
var checkMatch = match(42, matchAlways); | ||
assert.isTrue(checkMatch); | ||
}); | ||
|
||
it("returns true if matching boolean", function() { | ||
assert.isTrue(samsam.match(false, match.bool)); | ||
}); | ||
|
||
it("returns false if not matching boolean", function() { | ||
assert.isFalse(samsam.match(0, match.bool)); | ||
}); | ||
|
||
it("returns true if matching number", function() { | ||
assert.isTrue(samsam.match(42, match.number)); | ||
}); | ||
|
||
it("returns false if not matching number", function() { | ||
assert.isFalse(samsam.match("42", match.number)); | ||
}); | ||
|
||
it("returns true if matching string", function() { | ||
assert.isTrue(samsam.match("abc", match.string)); | ||
}); | ||
|
||
it("returns false if not matching string", function() { | ||
assert.isFalse(samsam.match(123, match.string)); | ||
}); | ||
|
||
it("returns true when matching nested matcher", function() { | ||
assert.isTrue(samsam.match({ x: 1 }, { x: match.number })); | ||
}); | ||
|
||
it("returns false when not matching nested matcher", function() { | ||
assert.isFalse(samsam.match({ x: 1 }, { x: match.string })); | ||
}); | ||
}); | ||
|
||
context("samsam.deepEqual", function() { | ||
it("returns true if matching boolean", function() { | ||
assert.isTrue(samsam.deepEqual(false, match.bool)); | ||
}); | ||
|
||
it("returns true when matching nested matcher", function() { | ||
assert.isTrue(samsam.deepEqual({ x: 1 }, { x: match.number })); | ||
}); | ||
|
||
it("returns false when not matching nested matcher", function() { | ||
assert.isFalse(samsam.deepEqual({ x: 1 }, { x: match.string })); | ||
}); | ||
}); | ||
}); |