UNPKG

wix-style-react

Version:
55 lines (42 loc) 1.59 kB
import eyes from 'eyes.it'; import { eyesItInstance } from './eyes-it'; jest.mock('eyes.it'); describe('eyesItInstance', function () { it('should call the original module with default config', function () { var instance = eyesItInstance(); var fn = jest.fn(); instance.it('should do something', fn); expect(eyes.it).toHaveBeenCalledWith('should do something', fn, { enableSnapshotAtBrowserGet: false }); }); it('should call the original module with predefined config', function () { var instance = eyesItInstance({ myConfigField: 'value' }); var fn = jest.fn(); instance.it('should do something', fn); expect(eyes.it).toHaveBeenCalledWith('should do something', fn, expect.objectContaining({ myConfigField: 'value' })); }); it('should allow overriding default config', function () { var instance = eyesItInstance({ myConfigField: 'value', enableSnapshotAtBrowserGet: true }); var fn = jest.fn(); instance.it('should do something', fn); expect(eyes.it).toHaveBeenCalledWith('should do something', fn, { myConfigField: 'value', enableSnapshotAtBrowserGet: true }); }); it('should merge test-specific config', function () { var instance = eyesItInstance({ myConfigField: 'value' }); var fn = jest.fn(); instance.it('should do something', fn, { myAnotherConfigField: 'value' }); expect(eyes.it).toHaveBeenCalledWith('should do something', fn, expect.objectContaining({ myConfigField: 'value', myAnotherConfigField: 'value' })); }); });