Skip to content

Commit

Permalink
tests(homebrew): add test case for old url format
Browse files Browse the repository at this point in the history
  • Loading branch information
nikaro committed May 19, 2024
1 parent f4e53df commit c620360
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/modules/manager/homebrew/__snapshots__/extract.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,24 @@ exports[`modules/manager/homebrew/extract extractPackageFile() handles no space
}
`;

exports[`modules/manager/homebrew/extract extractPackageFile() handles old "archive" github url format 1`] = `
{
"deps": [
{
"currentValue": "v0.8.2",
"datasource": "github-tags",
"depName": "bazelbuild/bazel-watcher",
"managerData": {
"ownerName": "bazelbuild",
"repoName": "bazel-watcher",
"sha256": "26f5125218fad2741d3caf937b02296d803900e5f153f5b1f733f15391b9f9b4",
"url": "https://github.com/bazelbuild/bazel-watcher/archive/v0.8.2.tar.gz",
},
},
],
}
`;

exports[`modules/manager/homebrew/extract extractPackageFile() skips github dependency with wrong format 1`] = `
{
"deps": [
Expand Down
14 changes: 14 additions & 0 deletions lib/modules/manager/homebrew/extract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ describe('modules/manager/homebrew/extract', () => {
expect(res).toMatchSnapshot();
});

it('handles old "archive" github url format', () => {
const content = `class Ibazel < Formula
desc 'IBazel is a tool for building Bazel targets when source files change.'
homepage 'https://github.com/bazelbuild/bazel-watcher'
url "https://github.com/bazelbuild/bazel-watcher/archive/v0.8.2.tar.gz"
sha256 '26f5125218fad2741d3caf937b02296d803900e5f153f5b1f733f15391b9f9b4'
end
`;
const res = extractPackageFile(content);
expect(res).not.toBeNull();
expect(res?.deps[0].skipReason).toBeUndefined();
expect(res).toMatchSnapshot();
});

it('handles no space before class header', () => {
const content = `class Ibazel < Formula
desc 'IBazel is a tool for building Bazel targets when source files change.'
Expand Down

0 comments on commit c620360

Please sign in to comment.