Add tests for the versioning model

This commit is contained in:
Webber
2020-04-28 01:43:15 +02:00
committed by Webber Takken
parent 22c7d0e516
commit b6f8040f4a
9 changed files with 298 additions and 31 deletions

View File

@@ -1,9 +1,25 @@
expect.extend({
toBeOfType(received, expectedType) {
const type = typeof received;
const pass = type === expectedType;
const message = () => `
Expected value to be of type ${this.utils.printExpected(expectedType)},
but received ${this.utils.printReceived(type)}`;
return {
message,
pass,
};
},
toBeEitherAFunctionOrAnObject(received) {
const type = typeof received;
const pass = ['object', 'function'].includes(type);
const message = `Expected a function or an object, received ${type}`;
const message = () => `Expected a ${this.utils.printExpected('function')}
or an ${this.utils.printExpected('object')},
but received ${type}`;
return {
message,
@@ -11,5 +27,3 @@ expect.extend({
};
},
});
jest.mock('./model/input');