-
-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export function fail(_, message) { | ||
return { | ||
pass: false, | ||
message: () => (message ? message : 'fails by .fail() assertion'), | ||
}; | ||
} |
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export function pass(_, message) { | ||
return { | ||
pass: true, | ||
message: () => (message ? message : 'passes by .pass() assertion'), | ||
}; | ||
} |
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export function toBeAfter(date, after) { | ||
const { printReceived, matcherHint } = this.utils; | ||
const passMessage = | ||
matcherHint('.not.toBeAfter', 'received', '') + | ||
'\n\n' + | ||
`Expected date to be after ${printReceived(after)} but received:\n` + | ||
` ${printReceived(date)}`; | ||
|
||
const failMessage = | ||
matcherHint('.toBeAfter', 'received', '') + | ||
'\n\n' + | ||
`Expected date to be after ${printReceived(after)} but received:\n` + | ||
` ${printReceived(date)}`; | ||
|
||
const pass = date > after; | ||
|
||
return { pass, message: () => (pass ? passMessage : failMessage) }; | ||
} |
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export function toBeAfterOrEqualTo(actual, expected) { | ||
const { printReceived, matcherHint } = this.utils; | ||
|
||
const passMessage = | ||
matcherHint('.not.toBeAfterOrEqualTo', 'received', '') + | ||
'\n\n' + | ||
`Expected date to be after or equal to ${printReceived(expected)} but received:\n` + | ||
` ${printReceived(actual)}`; | ||
|
||
const failMessage = | ||
matcherHint('.toBeAfterOrEqualTo', 'received', '') + | ||
'\n\n' + | ||
`Expected date to be after or equal to ${printReceived(expected)} but received:\n` + | ||
` ${printReceived(actual)}`; | ||
|
||
const pass = actual >= expected; | ||
|
||
return { pass, message: () => (pass ? passMessage : failMessage) }; | ||
} |
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export function toBeArray(expected) { | ||
const { matcherHint, printReceived } = this.utils; | ||
|
||
const passMessage = | ||
matcherHint('.not.toBeArray', 'received', '') + | ||
'\n\n' + | ||
'Expected value to not be an array received:\n' + | ||
` ${printReceived(expected)}`; | ||
|
||
const failMessage = | ||
matcherHint('.toBeArray', 'received', '') + | ||
'\n\n' + | ||
'Expected value to be an array received:\n' + | ||
` ${printReceived(expected)}`; | ||
|
||
const pass = Array.isArray(expected); | ||
|
||
return { pass, message: () => (pass ? passMessage : failMessage) }; | ||
} |
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { determinePropertyMessage } from '../utils'; | ||
|
||
export function toBeArrayOfSize(actual, expected) { | ||
const { printExpected, printReceived, matcherHint } = this.utils; | ||
|
||
const passMessage = `${matcherHint('.not.toBeArrayOfSize')} | ||
Expected value to not be an array of size: | ||
${printExpected(expected)} | ||
Received: | ||
value: ${printReceived(actual)} | ||
length: ${printReceived(determinePropertyMessage(actual, 'length'))}`; | ||
|
||
const failMessage = `${matcherHint('.toBeArrayOfSize')} | ||
Expected value to be an array of size: | ||
${printExpected(expected)} | ||
Received: | ||
value: ${printReceived(actual)} | ||
length: ${printReceived(determinePropertyMessage(actual, 'length'))}`; | ||
|
||
const pass = Array.isArray(actual) && actual.length === expected; | ||
|
||
return { pass, message: () => (pass ? passMessage : failMessage) }; | ||
} |
This file was deleted.
This file was deleted.
This file was deleted.