DefinitelyTyped/types/chai-jest-snapshot/chai-jest-snapshot-tests.ts
Matthew Bull 233bdad5ad Fixing export to match package
chai-jest-snapshots doesn't use `export default`, so
`import * as chaiJestSnapshots from 'chai-jest-snapshots'` gives compiler errors and
`import chaiJestSnapshots from 'chai-jest-snapshots'` gives runtime errors
2018-05-09 14:54:57 +01:00

24 lines
714 B
TypeScript

import * as chaiJestSnapshot from 'chai-jest-snapshot';
import { expect } from 'chai';
chai.use(chaiJestSnapshot);
expect({}).to.matchSnapshot();
expect({}).to.matchSnapshot(true);
expect({}).to.matchSnapshot("filename");
expect({}).to.matchSnapshot("filename", "snapshotname");
expect({}).to.matchSnapshot("filename", "snapshotname", false);
const mockContext: Mocha.IBeforeAndAfterContext = <any> {
currentTest: {
file: 'testfile',
fullTitle: () => 'fullTitle'
}
};
chaiJestSnapshot.setFilename("filename");
chaiJestSnapshot.setTestName("testname");
chaiJestSnapshot.configureUsingMochaContext(mockContext);
chaiJestSnapshot.resetSnapshotRegistry();
chaiJestSnapshot.addSerializer({});