wix-style-react
Version:
wix-style-react
33 lines (25 loc) • 1.06 kB
JavaScript
;
var _deprecationLog = require('./deprecationLog');
var _deprecationLog2 = _interopRequireDefault(_deprecationLog);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var cachedConsoleWarn = global.console.warn;
describe('deprecationLog', function () {
beforeEach(function () {
global.console.warn = jest.fn();
});
afterEach(function () {
global.console.warn = cachedConsoleWarn;
});
it('should log the appropriate message content', function () {
(0, _deprecationLog2.default)('Some message');
expect(global.console.warn).toBeCalledWith('Wix-Style-React: [WARNING] Some message');
});
it('should log only once per message', function () {
(0, _deprecationLog2.default)('message');
expect(global.console.warn.mock.calls).toHaveLength(1);
(0, _deprecationLog2.default)('message');
expect(global.console.warn.mock.calls).toHaveLength(1);
(0, _deprecationLog2.default)('message2');
expect(global.console.warn.mock.calls).toHaveLength(2);
});
});