Skip to content

Commit 71bff91

Browse files
committed
chars.test.ts
1 parent fe8b3f3 commit 71bff91

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

test/chars.test.ts

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,56 @@
1-
import { green, red, gray } from "colorette"
1+
import { gray, green, red } from "colorette"
22
import assert from "node:assert/strict"
33
import { suite, test } from "node:test"
44
import stripAnsi from "strip-ansi"
55
import * as assertNoDiff from "../src/index"
66

7-
suite("assertNoDiff.chars()", function () {
8-
test("matching data", function () {
7+
suite("assertNoDiff.chars()", function() {
8+
test("matching data", function() {
99
const data = "Jean-Luc Picard"
1010
assertNoDiff.chars(data, data)
1111
})
1212

13-
test("mismatching data", function () {
13+
test("mismatching data", function() {
1414
const obj1 = "Jean-Luc Picard"
1515
const obj2 = "Captain Picard"
1616
const expected = `mismatching strings:
1717
1818
${red("Je")}${green("C")}${gray("a")}${green("ptai")}${gray("n")}${red("-Luc")}${gray(" Picard")}`
1919
assert.throws(
20-
function () {
20+
function() {
2121
assertNoDiff.chars(obj2, obj1)
2222
},
2323
new Error(expected),
2424
"should throw color-coded diff"
2525
)
2626
})
2727

28-
// test("no expected value", function () {
29-
// assert.throws(function () {
30-
// // @ts-ignore: intentional call without second argument
31-
// assertNoDiff.chars("foo")
32-
// }, new Error("AssertNoDiff: expected value not provided"))
33-
// })
28+
test("no expected value", function() {
29+
assert.throws(function() {
30+
// @ts-ignore: intentional call without second argument
31+
assertNoDiff.chars("foo")
32+
}, new Error("AssertNoDiff: expected value not provided"))
33+
})
3434

35-
// test("no actual value", function () {
36-
// assert.throws(function () {
37-
// // @ts-ignore: intentional call without arguments
38-
// assertNoDiff.chars()
39-
// }, new Error("AssertNoDiff: actual value not provided"))
40-
// })
35+
test("no actual value", function() {
36+
assert.throws(function() {
37+
// @ts-ignore: intentional call without arguments
38+
assertNoDiff.chars()
39+
}, new Error("AssertNoDiff: actual value not provided"))
40+
})
4141

42-
// test("providing a custom message", function () {
43-
// try {
44-
// assertNoDiff.chars("one", "two", "custom message")
45-
// } catch (e) {
46-
// const stripped = stripAnsi(e.message)
47-
// assert.equal(stripped, "custom message:\n\ntwone")
48-
// return
49-
// }
50-
// throw new Error("assertNoDiff.chars didn't throw")
51-
// })
42+
test("providing a custom message", function() {
43+
try {
44+
assertNoDiff.chars("one", "two", "custom message")
45+
} catch (e) {
46+
const stripped = stripAnsi(e.message)
47+
assert.equal(stripped, "custom message:\n\ntwone")
48+
return
49+
}
50+
throw new Error("assertNoDiff.chars didn't throw")
51+
})
5252

53-
// test("diffing against empty strings", function () {
54-
// assertNoDiff.chars("", "")
55-
// })
53+
test("diffing against empty strings", function() {
54+
assertNoDiff.chars("", "")
55+
})
5656
})

0 commit comments

Comments
 (0)