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