Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Sep 6, 2023
1 parent b65b354 commit 5bfae59
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions lib/modules/manager/npm/post-update/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,33 @@ describe('modules/manager/npm/post-update/index', () => {
]);
});

it('detects if lock file contents are unchanged', async () => {
spyNpm.mockResolvedValueOnce({ error: false, lockFile: '{}' });
fs.readLocalFile.mockImplementation((f): Promise<any> => {
if (f === 'package-lock.json') {
return Promise.resolve('{}');
}
return Promise.resolve(null);
});
git.getFile.mockImplementation((f) => {
if (f === 'package-lock.json') {
return Promise.resolve('{}');
}
return Promise.resolve(null);
});
expect(
(
await getAdditionalFiles(
{
...updateConfig,
updateLockFiles: true,
reuseExistingBranch: true,
},
additionalFiles
)
).updatedArtifacts.find((a) => a.path === 'package-lock.json')
).toBeUndefined();
});
it('works for yarn', async () => {
spyYarn.mockResolvedValueOnce({ error: false, lockFile: '{}' });
expect(
Expand Down

0 comments on commit 5bfae59

Please sign in to comment.