-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: don't depend on the GitHub API to check release (#391)
* fix: don't depend on the GitHub API to check release * chore: update generated content --------- Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
- Loading branch information
Showing
16 changed files
with
101 additions
and
825 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,52 @@ | ||
import {describe, expect, it} from '@jest/globals'; | ||
import * as github from '../src/github'; | ||
|
||
describe('github', () => { | ||
describe('getRelease', () => { | ||
it('returns latest GoReleaser GitHub release', async () => { | ||
const githubToken = process.env.GITHUB_TOKEN || ''; | ||
const release = await github.getRelease('goreleaser', 'latest', githubToken); | ||
const release = await github.getRelease('goreleaser', 'latest'); | ||
expect(release).not.toBeNull(); | ||
expect(release?.tag_name).not.toEqual(''); | ||
}); | ||
|
||
it('returns v0.182.0 GoReleaser GitHub release', async () => { | ||
const githubToken = process.env.GITHUB_TOKEN || ''; | ||
const release = await github.getRelease('goreleaser', 'v0.182.0', githubToken); | ||
const release = await github.getRelease('goreleaser', 'v0.182.0'); | ||
expect(release).not.toBeNull(); | ||
expect(release?.tag_name).toEqual('v0.182.0'); | ||
}); | ||
|
||
it('returns v0.182.1 GoReleaser GitHub release', async () => { | ||
const githubToken = process.env.GITHUB_TOKEN || ''; | ||
const release = await github.getRelease('goreleaser', '~> 0.182', githubToken); | ||
const release = await github.getRelease('goreleaser', '~> 0.182'); | ||
expect(release).not.toBeNull(); | ||
expect(release?.tag_name).toEqual('v0.182.1'); | ||
}); | ||
|
||
it('unknown GoReleaser release', async () => { | ||
await expect(github.getRelease('goreleaser', 'foo')).rejects.toThrowError( | ||
new Error('Cannot find GoReleaser release foo in https://goreleaser.com/static/releases.json') | ||
); | ||
}); | ||
|
||
it('returns latest GoReleaser Pro GitHub release', async () => { | ||
const githubToken = process.env.GITHUB_TOKEN || ''; | ||
const release = await github.getRelease('goreleaser-pro', 'latest', githubToken); | ||
const release = await github.getRelease('goreleaser-pro', 'latest'); | ||
expect(release).not.toBeNull(); | ||
expect(release?.tag_name).not.toEqual(''); | ||
}); | ||
|
||
it('returns v0.182.0-pro GoReleaser Pro GitHub release', async () => { | ||
const githubToken = process.env.GITHUB_TOKEN || ''; | ||
const release = await github.getRelease('goreleaser-pro', 'v0.182.0-pro', githubToken); | ||
it('returns v0.182.0 GoReleaser Pro GitHub release', async () => { | ||
const release = await github.getRelease('goreleaser-pro', 'v0.182.0'); | ||
expect(release).not.toBeNull(); | ||
expect(release?.tag_name).toEqual('v0.182.0-pro'); | ||
}); | ||
|
||
it('returns v0.182.1-pro GoReleaser Pro GitHub release when using semver', async () => { | ||
const githubToken = process.env.GITHUB_TOKEN || ''; | ||
const release = await github.getRelease('goreleaser-pro', '~> 0.182', githubToken); | ||
it('returns v0.182.1 GoReleaser Pro GitHub release', async () => { | ||
const release = await github.getRelease('goreleaser-pro', '~> 0.182'); | ||
expect(release).not.toBeNull(); | ||
expect(release?.tag_name).toEqual('v0.182.1-pro'); | ||
}); | ||
|
||
it('unknown GoReleaser Pro release', async () => { | ||
await expect(github.getRelease('goreleaser-pro', 'foo')).rejects.toThrowError( | ||
new Error('Cannot find GoReleaser release foo-pro in https://goreleaser.com/static/releases-pro.json') | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.