UNPKG

react-native

Version:

A framework for building native apps using React

58 lines (50 loc) 1.56 kB
/** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * All rights reserved. * * @emails oncall+javascript_foundation */ 'use strict'; jest.mock('fs'); const findPodspecName = require('../../ios/findPodspecName'); const fs = require('fs'); const projects = require('../../__fixtures__/projects'); const ios = require('../../__fixtures__/ios'); describe('ios::findPodspecName', () => { it('returns null if there is not podspec file', () => { fs.__setMockFilesystem(projects.flat); expect(findPodspecName('')).toBeNull(); }); it('returns podspec name if only one exists', () => { fs.__setMockFilesystem(ios.pod); expect(findPodspecName('/')).toBe('TestPod'); }); it('returns podspec name that match packet directory', () => { fs.__setMockFilesystem({ user: { PacketName: { 'Another.podspec': 'empty', 'PacketName.podspec': 'empty' } } }); expect(findPodspecName('/user/PacketName')).toBe('PacketName'); }); it('returns first podspec name if not match in directory', () => { fs.__setMockFilesystem({ user: { packet: { 'Another.podspec': 'empty', 'PacketName.podspec': 'empty' } } }); expect(findPodspecName('/user/packet')).toBe('Another'); }); });