Skip to content
This repository was archived by the owner on Aug 20, 2024. It is now read-only.

Commit c23ef18

Browse files
author
Mark Skelton
committed
Simplify getMessage return value
1 parent c0d6d21 commit c23ef18

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/matchers/utils.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -121,17 +121,14 @@ export const getMessage = (
121121
expected: string | null,
122122
received: string | null
123123
) => {
124-
const matcherHint =
125-
utils.matcherHint(matcher, undefined, undefined, { isNot, promise }) +
126-
"\n\n"
127-
128-
if (isNot) {
129-
return matcherHint + `Expected: not ${utils.printExpected(expected)}`
130-
} else {
131-
return (
132-
matcherHint +
133-
`Expected: ${utils.printExpected(expected)}\n` +
124+
const message = isNot
125+
? `Expected: not ${utils.printExpected(expected)}`
126+
: `Expected: ${utils.printExpected(expected)}\n` +
134127
`Received: ${utils.printReceived(received)}`
135-
)
136-
}
128+
129+
return (
130+
utils.matcherHint(matcher, undefined, undefined, { isNot, promise }) +
131+
"\n\n" +
132+
message
133+
)
137134
}

0 commit comments

Comments
 (0)