Files
react-native/scripts/releases/set-version/__tests__/set-version-test.js
T
Luna Wei ebc2831d5b set unified version (#42776)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42776

Changelog: [Internal] set all monorepo packages (including react-native) to one version and update all inter-dependencies (including the template)

Reviewed By: huntie

Differential Revision: D53251917

fbshipit-source-id: 95330ca66dcb7234a3f09752ecc3ed9087ced4bf
2024-01-31 19:32:08 -08:00

47 lines
1.1 KiB
JavaScript

/**
* 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
* @format
*/
const setVersion = require('../index');
const path = require('path');
describe('setVersion', () => {
beforeAll(() => {
jest.mock('path', () => {
// $FlowIgnore[underconstrained-implicit-instantiation]
const originalPath = jest.requireActual('path');
return {
...originalPath,
dirname: () => originalPath.join(__dirname, '__fixtures__/two/levels'),
};
});
jest.mock('fs', () => {
// $FlowIgnore[underconstrained-implicit-instantiation]
const originalFs = jest.requireActual('fs');
return {
...originalFs,
writeFileSync: (packagePath, content) => {
expect(content).toMatchSnapshot(
path.basename(path.join(packagePath, '..')),
);
},
};
});
});
test('updates all public packages to version', () => {
setVersion('0.80.0');
});
afterAll(() => {
jest.unmock('path');
jest.unmock('fs');
});
});