Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const toHaveArrayMatcher = (received: any, propPath: string) =>
createResult({
message: () => `expected ${propPath} of ${received} to be an array`,
notMessage: () => `expected ${propPath} of ${received} not to be an array`,
pass: isArray(getIn(propPath.split('.'), received))
});
export const toHaveObjectMatcher = (received: any, propPath: string) =>
createResult({
message: () => `expected ${propPath} of ${received} to be object`,
notMessage: () => `expected ${propPath} of ${received} not to be object`,
pass: isObject(getIn(propPath.split('.'), received))
});
export const toHaveDateAfterMatcher = (received: any, propPath: string, otherDate: Date) =>
createResult({
message: () => `expected ${propPath} of ${received} to be date after ${otherDate}`,
notMessage: () => `expected ${propPath} of ${received} not to be date after ${otherDate}`,
pass: isAfter(otherDate, getIn(propPath.split('.'), received))
});
export const toHaveArrayOfBooleansMatcher = (received: any, propPath: string) =>
createResult({
message: () => `expected ${propPath} of ${received} to be an array of booleans`,
notMessage: () => `expected ${propPath} of ${received} not to be an array of booleans`,
pass: isArrayOfBooleans(getIn(propPath.split('.'), received))
});
export const toHaveArrayOfNumbersMatcher = (received: any, propPath: string) =>
createResult({
message: () => `expected ${propPath} of ${received} to be an array of numbers`,
notMessage: () => `expected ${propPath} of ${received} not to be an array of numbers`,
pass: isArrayOfNumbers(getIn(propPath.split('.'), received))
});
export const toHaveArrayOfObjectsMatcher = (received: any, propPath: string) =>
createResult({
message: () => `expected ${propPath} of ${received} to be an array of objects`,
notMessage: () => `expected ${propPath} of ${received} not to be an array of objects`,
pass: isArrayOfObjects(getIn(propPath.split('.'), received))
});
export const toHaveArrayOfSizeMatcher = (received: any, propPath: string, size: number) =>
createResult({
message: () => `expected ${propPath} of ${received} to be an array containing ${size} members`,
notMessage: () => `expected ${propPath} of ${received} not to be an array containing ${size} members`,
pass: isArrayOfSize(size, getIn(propPath.split('.'), received))
});
export const toHaveArrayOfStringsMatcher = (received: any, propPath: string) =>
createResult({
message: () => `expected ${propPath} of ${received} to be an array of strings`,
notMessage: () => `expected ${propPath} of ${received} not to be an array of strings`,
pass: isArrayOfStrings(getIn(propPath.split('.'), received))
});
export const toHaveDateBeforeMatcher = (received: any, propPath: string, otherDate: Date) =>
createResult({
message: () => `expected ${propPath} of ${received} to be date before ${otherDate}`,
notMessage: () => `expected ${propPath} of ${received} not to be date before ${otherDate}`,
pass: isBefore(otherDate, getIn(propPath.split('.'), received))
});
export const toHaveBooleanMatcher = (received: any, propPath: string) =>
createResult({
message: () => `expected ${propPath} of ${received} to be boolean`,
notMessage: () => `expected ${propPath} of ${received} not to be boolean`,
pass: isBoolean(getIn(propPath.split('.'), received))
});