Skip to content

Commit

Permalink
add test for falsy depNames
Browse files Browse the repository at this point in the history
  • Loading branch information
chludwig-haufe committed Aug 19, 2022
1 parent 98bdc14 commit f6b97a4
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions lib/modules/manager/pip_requirements/artifacts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,38 @@ describe('modules/manager/pip_requirements/artifacts', () => {
]);
});

it('ignores falsy depNames', async () => {
fs.readLocalFile.mockResolvedValueOnce('new content');
const execSnapshots = mockExecAll();
expect(
await updateArtifacts({
packageFileName: 'requirements.txt',
updatedDeps: [
{ depName: '' },
{ depName: 'atomicwrites' },
{ depName: undefined },
],
newPackageFileContent,
config,
})
).toEqual([
{
file: {
type: 'addition',
path: 'requirements.txt',
contents: 'new content',
},
},
]);

expect(execSnapshots).toMatchObject([
{
cmd: 'hashin atomicwrites==1.4.0 -r requirements.txt',
options: { cwd: '/tmp/github/some/repo' },
},
]);
});

it('catches and returns errors', async () => {
const execSnapshots = mockExecAll();
fs.readLocalFile.mockImplementation(() => {
Expand Down

0 comments on commit f6b97a4

Please sign in to comment.