Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from BeeMargarida/ms/equal-date-suport
feat: equal date support
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
const assert = require("assert"); | ||
const yonius = require("../.."); | ||
|
||
describe("#equal()", function() { | ||
it("should be able to verify that primitive values are equal", () => { | ||
let result; | ||
|
||
result = yonius.equal(1, 1); | ||
assert.strictEqual(result, true); | ||
|
||
result = yonius.equal(1, 2); | ||
assert.strictEqual(result, false); | ||
|
||
result = yonius.equal("string", "string"); | ||
assert.strictEqual(result, true); | ||
|
||
result = yonius.equal("string", "unknown"); | ||
assert.strictEqual(result, false); | ||
}); | ||
|
||
it("should be able to verify that date values are equal", () => { | ||
let result; | ||
|
||
result = yonius.equal(new Date(), new Date(2000, 1, 1)); | ||
console.log(new Date(), new Date(2000, 1, 1), result); | ||
assert.strictEqual(result, false); | ||
|
||
const date = new Date(); | ||
result = yonius.equal(date, date); | ||
assert.strictEqual(result, true); | ||
}); | ||
|
||
it("should be able to verify that object values are equal", () => { | ||
const object = { id: 1, name: "name" }; | ||
let result; | ||
|
||
result = yonius.equal(object, object); | ||
assert.strictEqual(result, true); | ||
|
||
result = yonius.equal(object, { id: 1 }); | ||
assert.strictEqual(result, false); | ||
}); | ||
}); |