/
githubmirror
/
gutenberg
Обзор
Документация
Войти
/
githubmirror
/
gutenberg
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
packages/dom/src/test/utils.js
22 строки
674 B
Marco Ciampini
ESLint: Replace strict config with bulk suppressions (#81248)
07 авг 2026, 14:34
Не верифицирован
07 авг 2026, 14:34
7f43eaf
Код
Авторство
О чём код?
import { assertIsDefined } from '../utils/assert-is-defined'; describe( 'assertIsDefined', () => { it( 'should throw if the variable is null', () => { expect( () => assertIsDefined( null, 'val' ) ).toThrow( "Expected 'val' to be defined, but received null" ); } ); it( 'should throw if the variable is undefined', () => { expect( () => assertIsDefined( undefined, 'val' ) ).toThrow( "Expected 'val' to be defined, but received undefined" ); } ); it.each( [ 0, '', NaN, -0, 1, new String(), {}, [], false, Infinity ] )( 'should not throw if the value is %s', ( val ) => { expect( () => assertIsDefined( val, 'val' ) ).not.toThrow(); } ); } );