UNPKG

react-native-integrate

Version:

Automate integration of additional code into React Native projects

26 lines (25 loc) 1.36 kB
"use strict"; /* eslint-disable @typescript-eslint/no-unsafe-call */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const { mockFs } = require('../../mocks/mockAll'); const path_1 = __importDefault(require("path")); const parseConfig_1 = require("../../../utils/parseConfig"); const mockIntegrateYml_1 = require("../../mocks/mockIntegrateYml"); describe('parseConfig', () => { it('should parse yml file correctly', () => { const integrateYmlPath = path_1.default.resolve(__dirname, '../mock-project/node_modules/test-package/integrate.yml'); mockFs.writeFileSync(integrateYmlPath, mockIntegrateYml_1.mockIntegrateYml); const config = (0, parseConfig_1.parseConfig)(integrateYmlPath); expect(config).toBeTruthy(); }); it('should throw with incorrect yml file', () => { const integrateYmlPath = path_1.default.resolve(__dirname, '../mock-project/node_modules/test-package/integrate.yml'); mockFs.writeFileSync(integrateYmlPath, mockIntegrateYml_1.mockIntegrateYml.replace('app_delegate', 'random')); expect(() => { (0, parseConfig_1.parseConfig)(integrateYmlPath); }).toThrowError('must be equal to constant'); }); });