DefinitelyTyped/types/jest-specific-snapshot/jest-specific-snapshot-tests.ts
2018-04-07 00:58:35 +10:00

17 lines
469 B
TypeScript

import { addSerializer, toMatchSpecificSnapshot } from 'jest-specific-snapshot';
import toJson from 'enzyme-to-json';
expect(100).toMatchSpecificSnapshot('mySnapshotFile.snap');
addSerializer(toJson);
function doSomeThing(received: any) {
return received;
}
expect.extend({
toMatchDecoratedSpecificSnapshot(received, snapshotFile) {
const data = doSomeThing(received);
return toMatchSpecificSnapshot.call(this, data, snapshotFile);
}
});