2022-03-21 12:43:41 +00:00
|
|
|
import {describe, expect, it} from '@jest/globals';
|
2020-08-18 15:40:31 +00:00
|
|
|
import * as github from '../src/github';
|
|
|
|
|
|
|
|
describe('github', () => {
|
|
|
|
it('returns latest buildx GitHub release', async () => {
|
2023-01-28 00:43:10 +00:00
|
|
|
const release = await github.getLatestRelease(process.env.GITHUB_TOKEN || '');
|
2020-08-18 15:40:31 +00:00
|
|
|
expect(release).not.toBeNull();
|
|
|
|
expect(release?.tag_name).not.toEqual('');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('returns v0.2.2 buildx GitHub release', async () => {
|
2023-01-28 00:43:10 +00:00
|
|
|
const release = await github.getReleaseTag('v0.2.2', process.env.GITHUB_TOKEN || '');
|
2020-08-18 15:40:31 +00:00
|
|
|
expect(release).not.toBeNull();
|
|
|
|
expect(release?.tag_name).toEqual('v0.2.2');
|
|
|
|
});
|
2023-01-28 00:43:10 +00:00
|
|
|
|
|
|
|
it('unknown release', async () => {
|
|
|
|
await expect(github.getReleaseTag('foo', process.env.GITHUB_TOKEN || '')).rejects.toThrowError(new Error('Cannot get release foo: HttpError: Not Found'));
|
|
|
|
});
|
2020-08-18 15:40:31 +00:00
|
|
|
});
|