Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delete expect and jest-matcher-utils dependencies
- Loading branch information
1 parent
cc53ef3
commit 5491f54
Showing
106 changed files
with
909 additions
and
1,031 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
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 |
---|---|---|
@@ -1,24 +1,22 @@ | ||
import { matcherHint, printReceived } from 'jest-matcher-utils'; | ||
|
||
import predicate from './predicate'; | ||
|
||
const passMessage = (received, after) => () => | ||
matcherHint('.not.toBeAfter', 'received', '') + | ||
const passMessage = (utils, received, after) => () => | ||
utils.matcherHint('.not.toBeAfter', 'received', '') + | ||
'\n\n' + | ||
`Expected date to be after ${printReceived(after)} but received:\n` + | ||
` ${printReceived(received)}`; | ||
`Expected date to be after ${utils.printReceived(after)} but received:\n` + | ||
` ${utils.printReceived(received)}`; | ||
|
||
const failMessage = (received, after) => () => | ||
matcherHint('.toBeAfter', 'received', '') + | ||
const failMessage = (utils, received, after) => () => | ||
utils.matcherHint('.toBeAfter', 'received', '') + | ||
'\n\n' + | ||
`Expected date to be after ${printReceived(after)} but received:\n` + | ||
` ${printReceived(received)}`; | ||
`Expected date to be after ${utils.printReceived(after)} but received:\n` + | ||
` ${utils.printReceived(received)}`; | ||
|
||
export function toBeAfter(date, after) { | ||
const pass = predicate(date, after); | ||
if (pass) { | ||
return { pass: true, message: passMessage(date, after) }; | ||
return { pass: true, message: passMessage(this.utils, date, after) }; | ||
} | ||
|
||
return { pass: false, message: failMessage(date, after) }; | ||
return { pass: false, message: failMessage(this.utils, date, after) }; | ||
} |
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 |
---|---|---|
@@ -1,24 +1,22 @@ | ||
import { matcherHint, printReceived } from 'jest-matcher-utils'; | ||
|
||
import predicate from './predicate'; | ||
|
||
const passMessage = (received, before) => () => | ||
matcherHint('.not.toBeAfterOrEqualTo', 'received', '') + | ||
const passMessage = (utils, received, before) => () => | ||
utils.matcherHint('.not.toBeAfterOrEqualTo', 'received', '') + | ||
'\n\n' + | ||
`Expected date to be after or equal to ${printReceived(before)} but received:\n` + | ||
` ${printReceived(received)}`; | ||
`Expected date to be after or equal to ${utils.printReceived(before)} but received:\n` + | ||
` ${utils.printReceived(received)}`; | ||
|
||
const failMessage = (received, before) => () => | ||
matcherHint('.toBeAfterOrEqualTo', 'received', '') + | ||
const failMessage = (utils, received, before) => () => | ||
utils.matcherHint('.toBeAfterOrEqualTo', 'received', '') + | ||
'\n\n' + | ||
`Expected date to be after or equal to ${printReceived(before)} but received:\n` + | ||
` ${printReceived(received)}`; | ||
`Expected date to be after or equal to ${utils.printReceived(before)} but received:\n` + | ||
` ${utils.printReceived(received)}`; | ||
|
||
export function toBeAfterOrEqualTo(date, after) { | ||
const pass = predicate(date, after); | ||
if (pass) { | ||
return { pass: true, message: passMessage(date, after) }; | ||
return { pass: true, message: passMessage(this.utils, date, after) }; | ||
} | ||
|
||
return { pass: false, message: failMessage(date, after) }; | ||
return { pass: false, message: failMessage(this.utils, date, after) }; | ||
} |
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 |
---|---|---|
@@ -1,24 +1,22 @@ | ||
import { matcherHint, printReceived } from 'jest-matcher-utils'; | ||
|
||
import predicate from './predicate'; | ||
|
||
const passMessage = received => () => | ||
matcherHint('.not.toBeArray', 'received', '') + | ||
const passMessage = (utils, received) => () => | ||
utils.matcherHint('.not.toBeArray', 'received', '') + | ||
'\n\n' + | ||
'Expected value to not be an array received:\n' + | ||
` ${printReceived(received)}`; | ||
` ${utils.printReceived(received)}`; | ||
|
||
const failMessage = received => () => | ||
matcherHint('.toBeArray', 'received', '') + | ||
const failMessage = (utils, received) => () => | ||
utils.matcherHint('.toBeArray', 'received', '') + | ||
'\n\n' + | ||
'Expected value to be an array received:\n' + | ||
` ${printReceived(received)}`; | ||
` ${utils.printReceived(received)}`; | ||
|
||
export function toBeArray(expected) { | ||
const pass = predicate(expected); | ||
if (pass) { | ||
return { pass: true, message: passMessage(expected) }; | ||
return { pass: true, message: passMessage(this.utils, expected) }; | ||
} | ||
|
||
return { pass: false, message: failMessage(expected) }; | ||
return { pass: false, message: failMessage(this.utils, expected) }; | ||
} |
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 |
---|---|---|
@@ -1,31 +1,30 @@ | ||
import { matcherHint, printExpected, printReceived } from 'jest-matcher-utils'; | ||
import { determinePropertyMessage } from '../../utils'; | ||
|
||
import predicate from './predicate'; | ||
|
||
const passMessage = (actual, expected) => () => | ||
`${matcherHint('.not.toBeArrayOfSize')} | ||
const passMessage = (utils, actual, expected) => () => | ||
`${utils.matcherHint('.not.toBeArrayOfSize')} | ||
Expected value to not be an array of size: | ||
${printExpected(expected)} | ||
${utils.printExpected(expected)} | ||
Received: | ||
value: ${printReceived(actual)} | ||
length: ${printReceived(determinePropertyMessage(actual, 'length'))}`; | ||
value: ${utils.printReceived(actual)} | ||
length: ${utils.printReceived(determinePropertyMessage(actual, 'length'))}`; | ||
|
||
const failMessage = (actual, expected) => () => | ||
`${matcherHint('.toBeArrayOfSize')} | ||
const failMessage = (utils, actual, expected) => () => | ||
`${utils.matcherHint('.toBeArrayOfSize')} | ||
Expected value to be an array of size: | ||
${printExpected(expected)} | ||
${utils.printExpected(expected)} | ||
Received: | ||
value: ${printReceived(actual)} | ||
length: ${printReceived(determinePropertyMessage(actual, 'length'))}`; | ||
value: ${utils.printReceived(actual)} | ||
length: ${utils.printReceived(determinePropertyMessage(actual, 'length'))}`; | ||
|
||
export function toBeArrayOfSize(actual, expected) { | ||
const pass = predicate(actual, expected); | ||
if (pass) { | ||
return { pass: true, message: passMessage(actual, expected) }; | ||
return { pass: true, message: passMessage(this.utils, actual, expected) }; | ||
} | ||
|
||
return { pass: false, message: failMessage(actual, expected) }; | ||
return { pass: false, message: failMessage(this.utils, actual, expected) }; | ||
} |
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 |
---|---|---|
@@ -1,24 +1,22 @@ | ||
import { matcherHint, printReceived } from 'jest-matcher-utils'; | ||
|
||
import predicate from './predicate'; | ||
|
||
const passMessage = (received, before) => () => | ||
matcherHint('.not.toBeBefore', 'received', '') + | ||
const passMessage = (utils, received, before) => () => | ||
utils.matcherHint('.not.toBeBefore', 'received', '') + | ||
'\n\n' + | ||
`Expected date to be before ${printReceived(before)} but received:\n` + | ||
` ${printReceived(received)}`; | ||
`Expected date to be before ${utils.printReceived(before)} but received:\n` + | ||
` ${utils.printReceived(received)}`; | ||
|
||
const failMessage = (received, before) => () => | ||
matcherHint('.toBeBefore', 'received', '') + | ||
const failMessage = (utils, received, before) => () => | ||
utils.matcherHint('.toBeBefore', 'received', '') + | ||
'\n\n' + | ||
`Expected date to be before ${printReceived(before)} but received:\n` + | ||
` ${printReceived(received)}`; | ||
`Expected date to be before ${utils.printReceived(before)} but received:\n` + | ||
` ${utils.printReceived(received)}`; | ||
|
||
export function toBeBefore(date, before) { | ||
const pass = predicate(date, before); | ||
if (pass) { | ||
return { pass: true, message: passMessage(date, before) }; | ||
return { pass: true, message: passMessage(this.utils, date, before) }; | ||
} | ||
|
||
return { pass: false, message: failMessage(date, before) }; | ||
return { pass: false, message: failMessage(this.utils, date, before) }; | ||
} |
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 |
---|---|---|
@@ -1,24 +1,22 @@ | ||
import { matcherHint, printReceived } from 'jest-matcher-utils'; | ||
|
||
import predicate from './predicate'; | ||
|
||
const passMessage = (received, before) => () => | ||
matcherHint('.not.toBeBeforeOrEqualTo', 'received', '') + | ||
const passMessage = (utils, received, before) => () => | ||
utils.matcherHint('.not.toBeBeforeOrEqualTo', 'received', '') + | ||
'\n\n' + | ||
`Expected date to be before or equal to ${printReceived(before)} but received:\n` + | ||
` ${printReceived(received)}`; | ||
`Expected date to be before or equal to ${utils.printReceived(before)} but received:\n` + | ||
` ${utils.printReceived(received)}`; | ||
|
||
const failMessage = (received, before) => () => | ||
matcherHint('.toBeBeforeOrEqualTo', 'received', '') + | ||
const failMessage = (utils, received, before) => () => | ||
utils.matcherHint('.toBeBeforeOrEqualTo', 'received', '') + | ||
'\n\n' + | ||
`Expected date to be before or equal to ${printReceived(before)} but received:\n` + | ||
` ${printReceived(received)}`; | ||
`Expected date to be before or equal to ${utils.printReceived(before)} but received:\n` + | ||
` ${utils.printReceived(received)}`; | ||
|
||
export function toBeBeforeOrEqualTo(date, before) { | ||
const pass = predicate(date, before); | ||
if (pass) { | ||
return { pass: true, message: passMessage(date, before) }; | ||
return { pass: true, message: passMessage(this.utils, date, before) }; | ||
} | ||
|
||
return { pass: false, message: failMessage(date, before) }; | ||
return { pass: false, message: failMessage(this.utils, date, before) }; | ||
} |
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 |
---|---|---|
@@ -1,24 +1,22 @@ | ||
import { matcherHint, printReceived } from 'jest-matcher-utils'; | ||
|
||
import predicate from './predicate'; | ||
|
||
const passMessage = (received, startDate, endDate) => () => | ||
matcherHint('.not.toBeBetween', 'received', '') + | ||
const passMessage = (utils, received, startDate, endDate) => () => | ||
utils.matcherHint('.not.toBeBetween', 'received', '') + | ||
'\n\n' + | ||
`Expected date to be between ${printReceived(startDate)} and ${printReceived(endDate)} but received:\n` + | ||
` ${printReceived(received)}`; | ||
`Expected date to be between ${utils.printReceived(startDate)} and ${utils.printReceived(endDate)} but received:\n` + | ||
` ${utils.printReceived(received)}`; | ||
|
||
const failMessage = (received, startDate, endDate) => () => | ||
matcherHint('.toBeBetween', 'received', '') + | ||
const failMessage = (utils, received, startDate, endDate) => () => | ||
utils.matcherHint('.toBeBetween', 'received', '') + | ||
'\n\n' + | ||
`Expected date to be between ${printReceived(startDate)} and ${printReceived(endDate)} but received:\n` + | ||
` ${printReceived(received)}`; | ||
`Expected date to be between ${utils.printReceived(startDate)} and ${utils.printReceived(endDate)} but received:\n` + | ||
` ${utils.printReceived(received)}`; | ||
|
||
export function toBeBetween(date, startDate, endDate) { | ||
const pass = predicate(date, startDate, endDate); | ||
if (pass) { | ||
return { pass: true, message: passMessage(date, startDate, endDate) }; | ||
return { pass: true, message: passMessage(this.utils, date, startDate, endDate) }; | ||
} | ||
|
||
return { pass: false, message: failMessage(date, startDate, endDate) }; | ||
return { pass: false, message: failMessage(this.utils, date, startDate, endDate) }; | ||
} |
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 |
---|---|---|
@@ -1,24 +1,22 @@ | ||
import { matcherHint, printReceived } from 'jest-matcher-utils'; | ||
|
||
import predicate from './predicate'; | ||
|
||
const passMessage = received => () => | ||
matcherHint('.not.toBeBoolean', 'received', '') + | ||
const passMessage = (utils, received) => () => | ||
utils.matcherHint('.not.toBeBoolean', 'received', '') + | ||
'\n\n' + | ||
'Expected value to not be of type boolean, received:\n' + | ||
` ${printReceived(received)}`; | ||
` ${utils.printReceived(received)}`; | ||
|
||
const failMessage = received => () => | ||
matcherHint('.toBeBoolean', 'received', '') + | ||
const failMessage = (utils, received) => () => | ||
utils.matcherHint('.toBeBoolean', 'received', '') + | ||
'\n\n' + | ||
'Expected value to be of type boolean, received:\n' + | ||
` ${printReceived(received)}`; | ||
` ${utils.printReceived(received)}`; | ||
|
||
export function toBeBoolean(received) { | ||
const pass = predicate(received); | ||
if (pass) { | ||
return { pass: true, message: passMessage(received) }; | ||
return { pass: true, message: passMessage(this.utils, received) }; | ||
} | ||
|
||
return { pass: false, message: failMessage(received) }; | ||
return { pass: false, message: failMessage(this.utils, received) }; | ||
} |
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 |
---|---|---|
@@ -1,24 +1,22 @@ | ||
import { matcherHint, printReceived } from 'jest-matcher-utils'; | ||
|
||
import predicate from './predicate'; | ||
|
||
const passMessage = received => () => | ||
matcherHint('.not.toBeDate', 'received', '') + | ||
const passMessage = (utils, received) => () => | ||
utils.matcherHint('.not.toBeDate', 'received', '') + | ||
'\n\n' + | ||
'Expected value to not be a date received:\n' + | ||
` ${printReceived(received)}`; | ||
` ${utils.printReceived(received)}`; | ||
|
||
const failMessage = received => () => | ||
matcherHint('.toBeDate', 'received', '') + | ||
const failMessage = (utils, received) => () => | ||
utils.matcherHint('.toBeDate', 'received', '') + | ||
'\n\n' + | ||
'Expected value to be a date received:\n' + | ||
` ${printReceived(received)}`; | ||
` ${utils.printReceived(received)}`; | ||
|
||
export function toBeDate(expected) { | ||
const pass = predicate(expected); | ||
if (pass) { | ||
return { pass: true, message: passMessage(expected) }; | ||
return { pass: true, message: passMessage(this.utils, expected) }; | ||
} | ||
|
||
return { pass: false, message: failMessage(expected) }; | ||
return { pass: false, message: failMessage(this.utils, expected) }; | ||
} |
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 |
---|---|---|
@@ -1,24 +1,22 @@ | ||
import { matcherHint, printReceived } from 'jest-matcher-utils'; | ||
|
||
import predicate from './predicate'; | ||
|
||
const passMessage = received => () => | ||
matcherHint('.not.toBeDateString', 'received', '') + | ||
const passMessage = (utils, received) => () => | ||
utils.matcherHint('.not.toBeDateString', 'received', '') + | ||
'\n\n' + | ||
'Expected value to not be a date string received:\n' + | ||
` ${printReceived(received)}`; | ||
` ${utils.printReceived(received)}`; | ||
|
||
const failMessage = received => () => | ||
matcherHint('.toBeDateString', 'received', '') + | ||
const failMessage = (utils, received) => () => | ||
utils.matcherHint('.toBeDateString', 'received', '') + | ||
'\n\n' + | ||
'Expected value to be a date string received:\n' + | ||
` ${printReceived(received)}`; | ||
` ${utils.printReceived(received)}`; | ||
|
||
export function toBeDateString(expected) { | ||
const pass = predicate(expected); | ||
if (pass) { | ||
return { pass: true, message: passMessage(expected) }; | ||
return { pass: true, message: passMessage(this.utils, expected) }; | ||
} | ||
|
||
return { pass: false, message: failMessage(expected) }; | ||
return { pass: false, message: failMessage(this.utils, expected) }; | ||
} |
Oops, something went wrong.