/
githubmirror
/
react-beautiful-dnd
Обзор
Документация
Войти
/
githubmirror
/
react-beautiful-dnd
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/unit/dev-warning.spec.js
32 строки
644 B
Alex Reardon
12.0 (#1487)
29 окт 2019, 01:40
Не верифицирован
29 окт 2019, 01:40
24a8e60
Код
Авторство
О чём код?
// @flow import { warning } from '../../src/dev-warning'; const warn = jest.spyOn(console, 'warn').mockImplementation(() => {}); afterEach(() => { warn.mockClear(); }); it('should log a warning to the console', () => { warning('hey'); expect(warn).toHaveBeenCalled(); }); it('should not log a warning if warnings are disabled', () => { window['__react-beautiful-dnd-disable-dev-warnings'] = true; warning('hey'); warning('sup'); warning('hi'); expect(warn).not.toHaveBeenCalled(); // re-enable window['__react-beautiful-dnd-disable-dev-warnings'] = false; warning('hey'); expect(warn).toHaveBeenCalled(); });