wix-style-react
Version:
wix-style-react
62 lines (45 loc) • 1.84 kB
JavaScript
'use strict';
var _eyes = require('eyes.it');
var _eyes2 = _interopRequireDefault(_eyes);
var _eyesIt = require('./eyes-it');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
jest.mock('eyes.it');
describe('eyesItInstance', function () {
it('should call the original module with default config', function () {
var instance = (0, _eyesIt.eyesItInstance)();
var fn = jest.fn();
instance.it('should do something', fn);
expect(_eyes2.default.it).toHaveBeenCalledWith('should do something', fn, {
enableSnapshotAtBrowserGet: false
});
});
it('should call the original module with predefined config', function () {
var instance = (0, _eyesIt.eyesItInstance)({ myConfigField: 'value' });
var fn = jest.fn();
instance.it('should do something', fn);
expect(_eyes2.default.it).toHaveBeenCalledWith('should do something', fn, expect.objectContaining({
myConfigField: 'value'
}));
});
it('should allow overriding default config', function () {
var instance = (0, _eyesIt.eyesItInstance)({
myConfigField: 'value',
enableSnapshotAtBrowserGet: true
});
var fn = jest.fn();
instance.it('should do something', fn);
expect(_eyes2.default.it).toHaveBeenCalledWith('should do something', fn, {
myConfigField: 'value',
enableSnapshotAtBrowserGet: true
});
});
it('should merge test-specific config', function () {
var instance = (0, _eyesIt.eyesItInstance)({ myConfigField: 'value' });
var fn = jest.fn();
instance.it('should do something', fn, { myAnotherConfigField: 'value' });
expect(_eyes2.default.it).toHaveBeenCalledWith('should do something', fn, expect.objectContaining({
myConfigField: 'value',
myAnotherConfigField: 'value'
}));
});
});