react-native/local-cli/link/__tests__/ios/mapHeaderSearchPaths.spec.js
Hector Ramos 23f72a9eb9 Correctly handle the case where HEADER_SEARCH_PATHS is a single string
Reviewed By: ericvicenti

Differential Revision: D5519379

fbshipit-source-id: a07ea0629f98c23e1027202cc7a7957233780643
2017-08-04 15:16:19 -07:00

38 lines
973 B
JavaScript

'use strict';
const xcode = require('xcode');
const mapHeaderSearchPaths = require('../../ios/mapHeaderSearchPaths');
const path = require('path');
const project = xcode.project(
path.join(__dirname, '../../__fixtures__/project.pbxproj')
);
describe('ios::mapHeaderSearchPaths', () => {
beforeEach(() => {
project.parseSync();
});
/**
* Based on the fixtures, our assumption is that this function
* has to be executed two times.
*/
it('should be called twice', () => {
const callback = jest.fn();
mapHeaderSearchPaths(project, callback);
expect(callback.mock.calls.length).toBe(2);
});
it('calls the function with an array of paths, given a project with one', () => {
const callback = jest.fn();
mapHeaderSearchPaths(project, callback);
const paths = callback.mock.calls[0][0];
expect(paths instanceof Array).toBe(true);
expect(paths.length).toBe(1);
expect(paths[0]).toBe('"$(inherited)"');
});
});