@@ -4,53 +4,53 @@ import { suite, test } from "node:test"
4
4
import stripAnsi from "strip-ansi"
5
5
import * as assertNoDiff from "../src/index"
6
6
7
- suite ( "assertNoDiff.wordsWithSpace" , function ( ) {
8
- test ( "matching data" , function ( ) {
7
+ suite ( "assertNoDiff.wordsWithSpace" , function ( ) {
8
+ test ( "matching data" , function ( ) {
9
9
const data = "Jean-Luc Picard"
10
10
assertNoDiff . wordsWithSpace ( data , data )
11
11
} )
12
12
13
- test ( "mismatching data" , function ( ) {
13
+ test ( "mismatching data" , function ( ) {
14
14
const obj1 = "Jean-Luc Picard"
15
15
const obj2 = "Captain Picard"
16
16
const expected = `mismatching words:
17
17
18
18
${ red ( "Jean-Luc" ) } ${ green ( "Captain" ) } ${ gray ( " Picard" ) } `
19
- assert . throws ( function ( ) {
19
+ assert . throws ( function ( ) {
20
20
assertNoDiff . wordsWithSpace ( obj2 , obj1 )
21
21
} , new Error ( expected ) )
22
22
} )
23
23
24
- test ( "extra whitespace" , function ( ) {
24
+ test ( "extra whitespace" , function ( ) {
25
25
const obj1 = "foo bar"
26
26
const obj2 = " foo bar"
27
27
const expected = `mismatching words:
28
28
29
29
${ green ( " " ) } ${ gray ( "foo bar" ) } `
30
30
assert . throws (
31
- function ( ) {
31
+ function ( ) {
32
32
assertNoDiff . wordsWithSpace ( obj2 , obj1 )
33
33
} ,
34
34
new Error ( expected ) ,
35
35
"should not tolerate surrounding whitespace"
36
36
)
37
37
} )
38
38
39
- test ( "no expected value" , function ( ) {
40
- assert . throws ( function ( ) {
39
+ test ( "no expected value" , function ( ) {
40
+ assert . throws ( function ( ) {
41
41
// @ts -ignore
42
42
assertNoDiff . wordsWithSpace ( "foo" )
43
43
} , new Error ( "AssertNoDiff: expected value not provided" ) )
44
44
} )
45
45
46
- test ( "no actual value" , function ( ) {
47
- assert . throws ( function ( ) {
46
+ test ( "no actual value" , function ( ) {
47
+ assert . throws ( function ( ) {
48
48
// @ts -ignore
49
49
assertNoDiff . wordsWithSpace ( )
50
50
} , new Error ( "AssertNoDiff: actual value not provided" ) )
51
51
} )
52
52
53
- test ( "custom error message" , function ( ) {
53
+ test ( "custom error message" , function ( ) {
54
54
try {
55
55
assertNoDiff . wordsWithSpace ( "one" , "two" , "custom message" )
56
56
} catch ( e ) {
@@ -61,7 +61,7 @@ ${green(" ")}${gray("foo bar")}`
61
61
throw new Error ( "assertNoDiff.wordsWithSpace didn't throw" )
62
62
} )
63
63
64
- test ( "empty strings" , function ( ) {
64
+ test ( "empty strings" , function ( ) {
65
65
assertNoDiff . wordsWithSpace ( "" , "" , "should allow diffing empty strings" )
66
66
} )
67
67
} )
0 commit comments