UNPKG

react-native-integrate

Version:

Automate integration of additional code into React Native projects

33 lines (32 loc) 1.39 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 getModContent_1 = require("../../../utils/getModContent"); const configPath = 'path/to/config/integrate.yml'; const packageName = 'test'; const file = 'folder/file.txt'; const fileContent = 'test'; describe('getModContent', () => { it('should return text', async () => { const content = await (0, getModContent_1.getModContent)(configPath, packageName, fileContent); expect(content).toBe(fileContent); }); it('should return file content', async () => { const filePath = path_1.default.join(configPath, '..', file); mockFs.writeFileSync(filePath, fileContent); const content = await (0, getModContent_1.getModContent)(configPath, packageName, { file: file, }); expect(content).toBe(fileContent); }); it('should throw if file not found', async () => { await expect((0, getModContent_1.getModContent)(configPath, packageName, { file: file, })).rejects.toThrowError('File not found'); }); });