Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <[email protected]>
  • Loading branch information
crazy-max committed Sep 8, 2023
1 parent 4685e91 commit 28094b6
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ const setRegistrySpy = jest.spyOn(stateHelper, 'setRegistry');
const setLogoutSpy = jest.spyOn(stateHelper, 'setLogout');
const dockerLoginSpy = jest.spyOn(docker, 'login').mockImplementation(() => Promise.resolve());

test('errors without username and password', async () => {
process.env['INPUT_LOGOUT'] = 'true'; // default value
await expect(main()).rejects.toThrow(new Error('Username and password required'));
});

test('successful with username and password', async () => {
test('login to Docker Hub', async () => {
const username = 'dbowie';
process.env[`INPUT_USERNAME`] = username;

Expand All @@ -35,7 +30,7 @@ test('successful with username and password', async () => {
expect(dockerLoginSpy).toHaveBeenCalledWith('', username, password, ecr);
});

test('calls docker login', async () => {
test('login to ghcr.io', async () => {
const username = 'dbowie';
process.env[`INPUT_USERNAME`] = username;

Expand Down

0 comments on commit 28094b6

Please sign in to comment.