-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for more class types like regex
- Loading branch information
1 parent
de62aca
commit ca51b2c
Showing
3 changed files
with
53 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { test } from "uvu"; | ||
import * as assert from "uvu/assert"; | ||
import diff from "../dist/index.js"; | ||
|
||
test("Handles equal string classes", () => { | ||
assert.equal( | ||
diff({ string: new String("hi") }, { string: new String("hi") }), | ||
[] | ||
); | ||
}); | ||
|
||
test("Handles equal number classes", () => { | ||
assert.equal(diff({ number: new Number(1) }, { number: new Number(1) }), []); | ||
}); | ||
|
||
test("Handles unequal number classes", () => { | ||
assert.equal(diff({ number: new Number(1) }, { number: new Number(2) }), [ | ||
{ | ||
type: "CHANGE", | ||
path: ["number"], | ||
value: 2, | ||
}, | ||
]); | ||
}); | ||
|
||
test.run(); |
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,19 @@ | ||
import { test } from "uvu"; | ||
import * as assert from "uvu/assert"; | ||
import diff from "../dist/index.js"; | ||
|
||
test("Handles equal regex", () => { | ||
assert.equal(diff({ regex: /a/ }, { regex: /a/ }), []); | ||
}); | ||
|
||
test("Handles unequal regex", () => { | ||
assert.equal(diff({ regex: /a/ }, { regex: /b/ }), [ | ||
{ | ||
type: "CHANGE", | ||
path: ["regex"], | ||
value: /b/, | ||
}, | ||
]); | ||
}); | ||
|
||
test.run(); |