2017-11-02 06:14:11 -07:00
|
|
|
/**
|
2018-02-08 17:10:29 -08:00
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
2017-11-02 06:14:11 -07:00
|
|
|
*
|
2018-02-16 18:24:55 -08:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2017-11-02 06:14:11 -07:00
|
|
|
*
|
2018-05-11 12:43:49 -07:00
|
|
|
* @format
|
2017-11-02 06:14:11 -07:00
|
|
|
* @emails oncall+javascript_foundation
|
|
|
|
*/
|
|
|
|
|
2017-10-17 21:19:53 -07:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const path = require('path');
|
|
|
|
const isInstalled = require('../../pods/isInstalled');
|
|
|
|
|
|
|
|
const PODFILES_PATH = path.join(__dirname, '../../__fixtures__/pods');
|
|
|
|
|
|
|
|
describe('pods::isInstalled', () => {
|
|
|
|
it('returns false if pod is missing', () => {
|
2018-05-11 12:43:49 -07:00
|
|
|
const project = {podfile: path.join(PODFILES_PATH, 'PodfileSimple')};
|
|
|
|
const podspecName = {podspec: 'NotExisting'};
|
2017-10-17 21:19:53 -07:00
|
|
|
expect(isInstalled(project, podspecName)).toBe(false);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('returns true for existing pod with version number', () => {
|
2018-05-11 12:43:49 -07:00
|
|
|
const project = {podfile: path.join(PODFILES_PATH, 'PodfileSimple')};
|
|
|
|
const podspecName = {podspec: 'TestPod'};
|
2017-10-17 21:19:53 -07:00
|
|
|
expect(isInstalled(project, podspecName)).toBe(true);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('returns true for existing pod with path', () => {
|
2018-05-11 12:43:49 -07:00
|
|
|
const project = {podfile: path.join(PODFILES_PATH, 'PodfileWithTarget')};
|
|
|
|
const podspecName = {podspec: 'Yoga'};
|
2017-10-17 21:19:53 -07:00
|
|
|
expect(isInstalled(project, podspecName)).toBe(true);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('returns true for existing pod with multiline definition', () => {
|
2018-05-11 12:43:49 -07:00
|
|
|
const project = {podfile: path.join(PODFILES_PATH, 'PodfileWithFunction')};
|
|
|
|
const podspecName = {podspec: 'React'};
|
2017-10-17 21:19:53 -07:00
|
|
|
expect(isInstalled(project, podspecName)).toBe(true);
|
|
|
|
});
|
|
|
|
});
|