Skip to content

Commit

Permalink
Add test case for shallow and submodules
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperSandro2000 committed Oct 13, 2024
1 parent 0e0e5e0 commit 46609ca
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
28 changes: 28 additions & 0 deletions lib/modules/manager/nix/__fixtures__/flake.8.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1728492678,
"narHash": "sha256-9UTxR8eukdg+XZeHgxW5hQA9fIKHsKCdOIUycTryeVw=",
"ref": "nixos-unstable",
"rev": "5633bcff0c6162b9e4b5f1264264611e950c8ec7",
"shallow": true,
"type": "git",
"url": "https://github.com/NixOS/nixpkgs"
},
"original": {
"ref": "nixos-unstable",
"shallow": true,
"type": "git",
"url": "https://github.com/NixOS/nixpkgs"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
12 changes: 12 additions & 0 deletions lib/modules/manager/nix/extract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const flake4Lock = Fixtures.get('flake.4.lock');
const flake5Lock = Fixtures.get('flake.5.lock');
const flake6Lock = Fixtures.get('flake.6.lock');
const flake7Lock = Fixtures.get('flake.7.lock');
const flake8Lock = Fixtures.get('flake.8.lock');

describe('modules/manager/nix/extract', () => {
it('returns null when no inputs', () => {
Expand Down Expand Up @@ -75,4 +76,15 @@ describe('modules/manager/nix/extract', () => {
it('test other version', () => {
expect(extractPackageFile(flake7Lock, 'flake.lock')).toBeNull();
});

it('includes nixpkgs with ref and shallow arguments', () => {
expect(extractPackageFile(flake8Lock, 'flake.lock')?.deps).toMatchObject([
{
currentDigest: '5633bcff0c6162b9e4b5f1264264611e950c8ec7',
datasource: 'git-refs',
depName: 'nixpkgs',
packageName: 'https://github.com/NixOS/nixpkgs',
},
]);
});
});
1 change: 1 addition & 0 deletions lib/modules/manager/nix/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const LockedInput = z.object({
ref: z.string().optional(),
rev: z.string(),
revCount: z.number().optional(),
shallow: z.boolean().optional(),
type: InputType,
url: z.string().optional(),
});
Expand Down

0 comments on commit 46609ca

Please sign in to comment.