/
githubmirror
/
react-native
Обзор
Документация
Войти
/
githubmirror
/
react-native
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
scripts/releases/utils/__tests__/scm-utils-test.js
58 строк
1 KB
Alex Hunt
Migrate Node.js builtin imports to node: scheme (#57611)
21 июл 2026, 19:01
21 июл 2026, 19:01
89300ac
Код
Авторство
О чём код?
/** * 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. * * @flow strict-local * @format */ const {isTaggedLatest} = require('../scm-utils'); let execResult = null; jest .mock('shelljs', () => ({ exec: () => { return { stdout: execResult, }; }, echo: message => { console.log(message); }, exit: exitCode => { process.exit(exitCode); }, })) .mock('node:fs', () => ({ existsSync: jest.fn().mockImplementation(_ => true), })) .mock('node:path', () => ({ dirname: jest .fn() .mockImplementation(filePath => filePath.includes('/') ? filePath.split('/')[0] : '.', ), })); describe('scm-utils', () => { beforeEach(() => { jest.resetModules(); jest.resetAllMocks(); }); describe('isTaggedLatest', () => { it('it should identify commit as tagged `latest`', () => { execResult = '6c19dc3266b84f47a076b647a1c93b3c3b69d2c5\n'; expect(isTaggedLatest('6c19dc3266b84f47a076b647a1c93b3c3b69d2c5')).toBe( true, ); }); it('it should not identify commit as tagged `latest`', () => { execResult = '6c19dc3266b84f47a076b647a1c93b3c3b69d2c5\n'; expect(isTaggedLatest('6c19dc3266b8')).toBe(false); }); }); });