react-native-integrate
Version:
Automate integration of additional code into React Native projects
22 lines (21 loc) • 1.17 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
require('../../../mocks/mockAll');
const validateOldProjectPath_1 = require("../../../../utils/upgrade/validateOldProjectPath");
const mockFs_1 = require("../../../mocks/mockFs");
describe('validateOldProjectPath', () => {
it('should return void when empty', () => {
expect((0, validateOldProjectPath_1.validateOldProjectPath)('')).toBeUndefined();
});
it('should return message when path does not exist', () => {
expect((0, validateOldProjectPath_1.validateOldProjectPath)('/path')).toMatch('path does not exist');
});
it('should return message when path is not a directory', () => {
mockFs_1.mockFs.writeFileSync('/path', 'content');
expect((0, validateOldProjectPath_1.validateOldProjectPath)('/path')).toMatch('path must be a directory');
});
it('should return message when path does not contain package.json', () => {
mockFs_1.mockFs.writeFileSync('/path/random', 'content');
expect((0, validateOldProjectPath_1.validateOldProjectPath)('/path')).toMatch('path must contain a package.json file');
});
});