2018-05-09 06:03:59 +00:00
|
|
|
const {
|
|
|
|
flattenUpdates,
|
|
|
|
} = require('../../../../lib/workers/repository/updates/flatten');
|
|
|
|
|
|
|
|
let config;
|
|
|
|
beforeEach(() => {
|
|
|
|
jest.resetAllMocks();
|
|
|
|
config = { ...require('../../../_fixtures/config') };
|
|
|
|
config.errors = [];
|
|
|
|
config.warnings = [];
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('workers/repository/updates/flatten', () => {
|
|
|
|
describe('flattenUpdates()', () => {
|
|
|
|
it('flattens', async () => {
|
|
|
|
config.lockFileMaintenance.enabled = true;
|
|
|
|
const packageFiles = {
|
|
|
|
npm: [
|
|
|
|
{
|
|
|
|
packageFile: 'package.json ',
|
|
|
|
deps: [
|
2018-06-04 03:48:20 +00:00
|
|
|
{ depName: '@org/a', updates: [{ newValue: '1.0.0' }] },
|
|
|
|
{ updates: [{ newValue: '2.0.0' }] },
|
2018-05-09 06:03:59 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
2018-06-29 04:55:42 +00:00
|
|
|
docker: [
|
|
|
|
{
|
|
|
|
packageFile: 'Dockerfile',
|
|
|
|
deps: [
|
|
|
|
{
|
|
|
|
depName: 'amd64/node',
|
|
|
|
language: 'docker',
|
|
|
|
updates: [{ newValue: '10.0.1' }],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
2018-05-09 06:03:59 +00:00
|
|
|
};
|
|
|
|
const res = await flattenUpdates(config, packageFiles);
|
|
|
|
expect(res).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|