Skip to content

Commit 5c55d3b

Browse files
committed
fix: added unit test case
1 parent 66ce0c5 commit 5c55d3b

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

__tests__/diff-snapshot.spec.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,22 @@ describe('diff-snapshot', () => {
695695
expect(diffResult).toHaveProperty('diffOutputPath', path.join(mockSnapshotsDir, '__diff_output__', `${mockSnapshotIdentifier}-diff.png`));
696696
});
697697

698+
describe('diffImageToSnapshot', () => {
699+
it('should fail if snapshot already exists', () => {
700+
const { diffImageToSnapshot } = setupTest({ snapshotExists: true });
701+
const options = {
702+
receivedImageBuffer: mockFailImageBuffer,
703+
snapshotIdentifier: mockSnapshotIdentifier,
704+
snapshotsDir: mockSnapshotsDir,
705+
updateSnapshot: false,
706+
};
707+
708+
expect(() => {
709+
diffImageToSnapshot(options);
710+
}).toThrow();
711+
});
712+
});
713+
698714
it('should throw an error if an unknown threshold type is supplied', () => {
699715
const diffImageToSnapshot = setupTest({ snapshotExists: true });
700716

0 commit comments

Comments
 (0)