2016-09-19 19:30:50 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
});
|
|
|
|
});
|