/
githubmr
/
facebook-react
Обзор
Документация
Войти
/
githubmr
/
facebook-react
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
packages/shared/__tests__/normalizeConsoleFormat-test.internal.js
51 строка
1 KB
Sebastian Markbåge
[Flight] Prefix Replayed Console Logs with a Badge (#28403)
21 фев 2024, 22:59
Не верифицирован
21 фев 2024, 22:59
c027406
Код
Авторство
О чём код?
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @emails react-core */ 'use strict'; let normalizeConsoleFormat; describe('normalizeConsoleFormat', () => { beforeEach(() => { normalizeConsoleFormat = require('shared/normalizeConsoleFormat').default; }); it('normalize empty string', async () => { expect(normalizeConsoleFormat('', [1, {}, 'foo'], 0)).toMatchInlineSnapshot( `"%o %o %s"`, ); }); it('normalize extra args', async () => { expect( normalizeConsoleFormat('%f', [1, {}, 'foo'], 0), ).toMatchInlineSnapshot(`"%f %o %s"`); }); it('normalize fewer than args', async () => { expect( normalizeConsoleFormat('%s %O %o %f', [1, {}, 'foo'], 0), ).toMatchInlineSnapshot(`"%s %O %o %%f"`); }); it('normalize escape sequences', async () => { expect( normalizeConsoleFormat('hel%lo %s %%s world', [1, 'foo'], 0), ).toMatchInlineSnapshot(`"hel%lo %s %%s world %s"`); }); it('normalize ending with escape', async () => { expect( normalizeConsoleFormat('hello %s world %', [1, {}, 'foo'], 0), ).toMatchInlineSnapshot(`"hello %s world % %o %s"`); expect( normalizeConsoleFormat('hello %s world %', [], 0), ).toMatchInlineSnapshot(`"hello %%s world %"`); }); });