2016-09-19 19:30:50 +00:00
|
|
|
/**
|
2018-02-09 01:10:29 +00:00
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
2016-09-19 19:30:50 +00:00
|
|
|
* 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.
|
2017-11-02 13:14:11 +00:00
|
|
|
*
|
|
|
|
* @emails oncall+javascript_foundation
|
2016-09-19 19:30:50 +00:00
|
|
|
*/
|
|
|
|
|
2016-07-30 15:59:16 +00:00
|
|
|
'use strict';
|
|
|
|
|
2016-08-22 15:56:14 +00:00
|
|
|
const getProjectDependencies = require('../getProjectDependencies');
|
2016-05-20 11:52:08 +00:00
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
describe('getProjectDependencies', () => {
|
2016-09-19 19:30:50 +00:00
|
|
|
beforeEach(() => {
|
|
|
|
jest.resetModules();
|
|
|
|
});
|
2016-05-20 11:52:08 +00:00
|
|
|
it('should return an array of project dependencies', () => {
|
2016-07-30 15:59:16 +00:00
|
|
|
jest.setMock(
|
2016-05-20 11:52:08 +00:00
|
|
|
path.join(process.cwd(), './package.json'),
|
2016-07-30 15:59:16 +00:00
|
|
|
{ dependencies: { lodash: '^6.0.0', 'react-native': '^16.0.0' }}
|
2016-05-20 11:52:08 +00:00
|
|
|
);
|
|
|
|
|
2016-07-30 15:59:16 +00:00
|
|
|
expect(getProjectDependencies()).toEqual(['lodash']);
|
2016-05-20 11:52:08 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should return an empty array when no dependencies set', () => {
|
2016-07-30 15:59:16 +00:00
|
|
|
jest.setMock(path.join(process.cwd(), './package.json'), {});
|
|
|
|
expect(getProjectDependencies()).toEqual([]);
|
2016-05-20 11:52:08 +00:00
|
|
|
});
|
|
|
|
});
|