2016-07-30 15:59:16 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
jest.autoMockOff();
|
|
|
|
|
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', () => {
|
|
|
|
|
|
|
|
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
|
|
|
});
|
|
|
|
});
|