Skip to content

Commit

Permalink
ensure invalid lockfile versions don't throw
Browse files Browse the repository at this point in the history
  • Loading branch information
SnakeDoc committed Aug 22, 2024
1 parent ec2d616 commit 71b2bd0
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions lib/modules/manager/gleam/extract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,30 @@ describe('modules/manager/gleam/extract', () => {
);
expect(extracted!.deps.every((dep) => 'lockedVersion' in dep)).toBe(false);
});

it('should handle invalid versions in lock file', async () => {
const packageFileContent = codeBlock`
name = "test_gleam_toml"
version = "1.0.0"
[dependencies]
foo = ">= 1.0.0 and < 2.0.0"
`;
const lockFileContent = codeBlock`
packages = [
{ name = "foo", version = "fooey", build_tools = ["gleam"], requirements = [], otp_app = "foo", source = "hex", outer_checksum = "5C66647D62BCB11FE327E7A6024907C4A17954EF22865FE0940B54A852446D01" },
]
[requirements]
foo = { version = ">= 1.0.0 and < 2.0.0" }
`;

fs.getSiblingFileName.mockReturnValueOnce('manifest.toml');
fs.readLocalFile.mockResolvedValueOnce(lockFileContent);
const extracted = await gleamManager.extractPackageFile(
packageFileContent,
'gleam.toml',
);
expect(extracted!.deps).not.toHaveProperty('lockedVersion');
});
});

0 comments on commit 71b2bd0

Please sign in to comment.