/
githubmirror
/
react-native
Обзор
Документация
Войти
/
githubmirror
/
react-native
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
.github/workflow-scripts/__tests__/verifyReleaseOnNpm-test.js
109 строк
3 KB
Sam Zhou
Update prettier-plugin-hermes-parser in fbsource to 0.31.1 (#52996)
02 авг 2025, 06:18
02 авг 2025, 06:18
16fa3d5
Код
Авторство
О чём код?
/** * 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. * * @format */ const {verifyReleaseOnNpm} = require('../verifyReleaseOnNpm'); const mockVerifyPublishedPackage = jest.fn(); const silence = () => {}; jest.mock('../utils.js', () => ({ log: silence, sleep: silence, })); jest.mock('../verifyPublishedPackage.js', () => ({ verifyPublishedPackage: mockVerifyPublishedPackage, })); describe('#verifyReleaseOnNPM', () => { beforeEach(jest.clearAllMocks); it("waits on npm updating for version and not 'latest'", async () => { const NOT_LATEST = false; const version = '0.78.0'; await verifyReleaseOnNpm(version, NOT_LATEST); expect(mockVerifyPublishedPackage).toHaveBeenLastCalledWith( 'react-native', version, null, 18, ); }); it('waits on npm updating version and latest tag', async () => { const IS_LATEST = true; const version = '0.78.0'; await verifyReleaseOnNpm(version, IS_LATEST); expect(mockVerifyPublishedPackage).toHaveBeenCalledWith( 'react-native', version, 'latest', 18, ); }); it('waits on npm updating version, not latest and next tag', async () => { const IS_LATEST = false; const version = '0.78.0-rc.0'; await verifyReleaseOnNpm(version, IS_LATEST); expect(mockVerifyPublishedPackage).toHaveBeenCalledWith( 'react-native', version, 'next', 18, ); }); it('waits on npm updating version, latest and next tag', async () => { const IS_LATEST = true; const version = '0.78.0-rc.0'; await verifyReleaseOnNpm(version, IS_LATEST); expect(mockVerifyPublishedPackage).toHaveBeenCalledWith( 'react-native', version, 'next', 18, ); }); describe('timeouts', () => { it('will timeout if npm does not update package version after a set number of retries', async () => { const RETRIES = 2; (await verifyReleaseOnNpm('0.77.0', true, RETRIES), expect(mockVerifyPublishedPackage).toHaveBeenCalledWith( 'react-native', '0.77.0', 'latest', 2, )); }); it('will timeout if npm does not update latest tag after a set number of retries', async () => { const RETRIES = 7; const IS_LATEST = true; await verifyReleaseOnNpm('0.77.0', IS_LATEST, RETRIES); expect(mockVerifyPublishedPackage).toHaveBeenCalledWith( 'react-native', '0.77.0', 'latest', 7, ); }); }); });