From 80a77efe026dec1991374cbcd20a2f6ab7834b79 Mon Sep 17 00:00:00 2001 From: Mike Date: Tue, 15 Feb 2022 13:48:55 +0100 Subject: [PATCH 1/2] chore: add test --- .../config/__tests__/getProjectConfig.test.ts | 42 +++++++++++++++++-- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/packages/platform-ios/src/config/__tests__/getProjectConfig.test.ts b/packages/platform-ios/src/config/__tests__/getProjectConfig.test.ts index ca1e99add..d92ea5085 100644 --- a/packages/platform-ios/src/config/__tests__/getProjectConfig.test.ts +++ b/packages/platform-ios/src/config/__tests__/getProjectConfig.test.ts @@ -5,12 +5,48 @@ * LICENSE file in the root directory of this source tree. * */ +import {projectConfig} from '../index'; jest.mock('path'); jest.mock('fs'); +const fs = require('fs'); + describe('ios::getProjectConfig', () => { - it.skip('returns `null` if Podfile was not found', () => {}); - it.skip('returns an object with ios project configuration', () => {}); - it.skip('returns correct configuration when multiple Podfile are present', () => {}); + it('returns `null` if Podfile was not found', () => { + fs.__setMockFilesystem({}); + expect(projectConfig('/', {})).toBe(null); + }); + it('returns an object with ios project configuration', () => { + fs.__setMockFilesystem({ + ios: { + Podfile: '', + }, + }); + expect(projectConfig('/', {})).toMatchInlineSnapshot(` + Object { + "sourceDir": "/ios", + "xcodeProject": null, + } + `); + }); + it('returns correct configuration when multiple Podfile are present', () => { + fs.__setMockFilesystem({ + sample: { + Podfile: '' + }, + ios: { + Podfile: '', + }, + example: { + Podfile: '', + } + }); + expect(projectConfig('/', {})).toMatchInlineSnapshot(` + Object { + "sourceDir": "/ios", + "xcodeProject": null, + } + `); + }); }); From 6fe9c4602385ec19473b6c030ab57f0343799a9b Mon Sep 17 00:00:00 2001 From: Mike Date: Tue, 15 Feb 2022 13:49:49 +0100 Subject: [PATCH 2/2] chore: fix lint --- .../src/config/__tests__/getProjectConfig.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/platform-ios/src/config/__tests__/getProjectConfig.test.ts b/packages/platform-ios/src/config/__tests__/getProjectConfig.test.ts index d92ea5085..99b3b6b38 100644 --- a/packages/platform-ios/src/config/__tests__/getProjectConfig.test.ts +++ b/packages/platform-ios/src/config/__tests__/getProjectConfig.test.ts @@ -33,14 +33,14 @@ describe('ios::getProjectConfig', () => { it('returns correct configuration when multiple Podfile are present', () => { fs.__setMockFilesystem({ sample: { - Podfile: '' + Podfile: '', }, ios: { Podfile: '', }, example: { Podfile: '', - } + }, }); expect(projectConfig('/', {})).toMatchInlineSnapshot(` Object {