/
githubmirror
/
gutenberg
Обзор
Документация
Войти
/
githubmirror
/
gutenberg
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
packages/editor/src/utils/test/sync-error-messages.js
32 строки
1 KB
Marco Ciampini
ESLint: Replace strict config with bulk suppressions (#81248)
07 авг 2026, 14:34
Не верифицирован
07 авг 2026, 14:34
7f43eaf
Код
Авторство
О чём код?
import { getSyncErrorMessages } from '../sync-error-messages'; describe( 'getSyncErrorMessages', () => { it.each( [ 'authentication-failed', 'connection-expired', 'connection-limit-exceeded', 'document-size-limit-exceeded', 'protocol-mismatch', 'unknown-error', ] )( 'should return title and description for "%s"', ( code ) => { const result = getSyncErrorMessages( { code } ); expect( result ).toEqual( expect.objectContaining( { title: expect.any( String ), description: expect.any( String ), } ) ); } ); it( 'should fall back to unknown-error for unrecognized codes', () => { const result = getSyncErrorMessages( { code: 'some-new-error' } ); const unknownResult = getSyncErrorMessages( { code: 'unknown-error' } ); expect( result ).toBe( unknownResult ); } ); it( 'should fall back to unknown-error when error is undefined', () => { const result = getSyncErrorMessages( undefined ); const unknownResult = getSyncErrorMessages( { code: 'unknown-error' } ); expect( result ).toBe( unknownResult ); } ); } );