2022-03-21 08:43:41 -04:00
|
|
|
import {describe, expect, it} from '@jest/globals';
|
2020-08-18 11:40:31 -04:00
|
|
|
import * as github from '../src/github';
|
|
|
|
|
|
|
|
describe('github', () => {
|
|
|
|
it('returns latest buildx GitHub release', async () => {
|
2023-01-27 19:43:10 -05:00
|
|
|
const release = await github.getLatestRelease(process.env.GITHUB_TOKEN || '');
|
2020-08-18 11:40:31 -04:00
|
|
|
expect(release).not.toBeNull();
|
|
|
|
expect(release?.tag_name).not.toEqual('');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('returns v0.2.2 buildx GitHub release', async () => {
|
2023-01-27 19:43:10 -05:00
|
|
|
const release = await github.getReleaseTag('v0.2.2', process.env.GITHUB_TOKEN || '');
|
2020-08-18 11:40:31 -04:00
|
|
|
expect(release).not.toBeNull();
|
|
|
|
expect(release?.tag_name).toEqual('v0.2.2');
|
|
|
|
});
|
2023-01-27 19:43:10 -05: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 11:40:31 -04:00
|
|
|
});
|