mirror of
https://github.com/docker/login-action.git
synced 2025-04-22 14:46:37 +02:00
Username required
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
4b15841c41
commit
1c2cf9942d
4 changed files with 30 additions and 40 deletions
|
@ -29,22 +29,22 @@ test('errors without password', async () => {
|
|||
});
|
||||
|
||||
test('successful with only password', async () => {
|
||||
const platSpy = jest.spyOn(osm, 'platform');
|
||||
platSpy.mockImplementation(() => 'linux');
|
||||
|
||||
const setRegistrySpy: jest.SpyInstance = jest.spyOn(stateHelper, 'setRegistry');
|
||||
const setLogoutSpy: jest.SpyInstance = jest.spyOn(stateHelper, 'setLogout');
|
||||
const dockerSpy: jest.SpyInstance = jest.spyOn(docker, 'login');
|
||||
dockerSpy.mockImplementation(() => {});
|
||||
|
||||
const password: string = 'groundcontrol';
|
||||
process.env[`INPUT_PASSWORD`] = password;
|
||||
const platSpy = jest.spyOn(osm, 'platform');
|
||||
platSpy.mockImplementation(() => 'linux');
|
||||
|
||||
await run();
|
||||
const setRegistrySpy: jest.SpyInstance = jest.spyOn(stateHelper, 'setRegistry');
|
||||
const setLogoutSpy: jest.SpyInstance = jest.spyOn(stateHelper, 'setLogout');
|
||||
const dockerSpy: jest.SpyInstance = jest.spyOn(docker, 'login');
|
||||
dockerSpy.mockImplementation(() => {});
|
||||
|
||||
expect(setRegistrySpy).toHaveBeenCalledWith('');
|
||||
expect(setLogoutSpy).toHaveBeenCalledWith('');
|
||||
expect(dockerSpy).toHaveBeenCalledWith('', '', password);
|
||||
const password: string = 'groundcontrol';
|
||||
process.env[`INPUT_PASSWORD`] = password;
|
||||
|
||||
await run();
|
||||
|
||||
expect(setRegistrySpy).toHaveBeenCalledWith('');
|
||||
expect(setLogoutSpy).toHaveBeenCalledWith('');
|
||||
expect(dockerSpy).toHaveBeenCalledWith('', '', password);
|
||||
});
|
||||
|
||||
test('calls docker login', async () => {
|
||||
|
@ -66,7 +66,7 @@ test('calls docker login', async () => {
|
|||
process.env[`INPUT_REGISTRY`] = registry;
|
||||
|
||||
const logout: string = 'true';
|
||||
process.env['INPUT_LOGOUT'] = logout
|
||||
process.env['INPUT_LOGOUT'] = logout;
|
||||
|
||||
await run();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue