mirror of
https://code.forgejo.org/docker/actions-toolkit.git
synced 2025-06-26 23:55:37 -04:00
github: throw if runtime token invalid
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
1098847fe7
commit
c3aa7f205d
2 changed files with 5 additions and 13 deletions
|
@ -130,18 +130,12 @@ describe('printActionsRuntimeTokenACs', () => {
|
|||
process.env = originalEnv;
|
||||
});
|
||||
it('empty', async () => {
|
||||
const warnSpy = jest.spyOn(core, 'warning');
|
||||
process.env.ACTIONS_RUNTIME_TOKEN = '';
|
||||
await GitHub.printActionsRuntimeTokenACs();
|
||||
expect(warnSpy).toHaveBeenCalledTimes(1);
|
||||
expect(warnSpy).toHaveBeenCalledWith(`ACTIONS_RUNTIME_TOKEN not set`);
|
||||
await expect(GitHub.printActionsRuntimeTokenACs()).rejects.toThrowError(new Error('ACTIONS_RUNTIME_TOKEN not set'));
|
||||
});
|
||||
it('malformed', async () => {
|
||||
const warnSpy = jest.spyOn(core, 'warning');
|
||||
process.env.ACTIONS_RUNTIME_TOKEN = 'foo';
|
||||
await GitHub.printActionsRuntimeTokenACs();
|
||||
expect(warnSpy).toHaveBeenCalledTimes(1);
|
||||
expect(warnSpy).toHaveBeenCalledWith(`Cannot parse Actions Runtime Token: Invalid token specified: Cannot read properties of undefined (reading 'replace')`);
|
||||
await expect(GitHub.printActionsRuntimeTokenACs()).rejects.toThrowError(new Error("Cannot parse GitHub Actions Runtime Token: Invalid token specified: Cannot read properties of undefined (reading 'replace')"));
|
||||
});
|
||||
it('refs/heads/master', async () => {
|
||||
const infoSpy = jest.spyOn(core, 'info');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue