2016-01-05 17:11:53 -08:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
*
|
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
|
2016-01-05 17:11:53 -08:00
|
|
|
*/
|
2018-05-11 12:43:49 -07:00
|
|
|
|
2016-01-05 17:11:53 -08:00
|
|
|
'use strict';
|
|
|
|
|
2017-06-13 15:01:42 -07:00
|
|
|
jest.dontMock('../findXcodeProject');
|
2016-01-05 17:11:53 -08:00
|
|
|
|
|
|
|
const findXcodeProject = require('../findXcodeProject');
|
|
|
|
|
|
|
|
describe('findXcodeProject', () => {
|
|
|
|
it('should find *.xcodeproj file', () => {
|
2018-05-11 12:43:49 -07:00
|
|
|
expect(
|
|
|
|
findXcodeProject([
|
|
|
|
'.DS_Store',
|
|
|
|
'AwesomeApp',
|
|
|
|
'AwesomeApp.xcodeproj',
|
|
|
|
'AwesomeAppTests',
|
|
|
|
'PodFile',
|
|
|
|
'Podfile.lock',
|
|
|
|
'Pods',
|
|
|
|
]),
|
|
|
|
).toEqual({
|
2016-01-05 17:11:53 -08:00
|
|
|
name: 'AwesomeApp.xcodeproj',
|
|
|
|
isWorkspace: false,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should prefer *.xcworkspace', () => {
|
2018-05-11 12:43:49 -07:00
|
|
|
expect(
|
|
|
|
findXcodeProject([
|
|
|
|
'.DS_Store',
|
|
|
|
'AwesomeApp',
|
|
|
|
'AwesomeApp.xcodeproj',
|
|
|
|
'AwesomeApp.xcworkspace',
|
|
|
|
'AwesomeAppTests',
|
|
|
|
'PodFile',
|
|
|
|
'Podfile.lock',
|
|
|
|
'Pods',
|
|
|
|
]),
|
|
|
|
).toEqual({
|
2016-01-05 17:11:53 -08:00
|
|
|
name: 'AwesomeApp.xcworkspace',
|
|
|
|
isWorkspace: true,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should return null if nothing found', () => {
|
2018-05-11 12:43:49 -07:00
|
|
|
expect(
|
|
|
|
findXcodeProject([
|
|
|
|
'.DS_Store',
|
|
|
|
'AwesomeApp',
|
|
|
|
'AwesomeAppTests',
|
|
|
|
'PodFile',
|
|
|
|
'Podfile.lock',
|
|
|
|
'Pods',
|
|
|
|
]),
|
|
|
|
).toEqual(null);
|
2016-01-05 17:11:53 -08:00
|
|
|
});
|
|
|
|
});
|