fix for promise

This commit is contained in:
Atharva Mulmuley 2021-06-03 13:34:02 +05:30
parent a9efce630c
commit f6f69bcd60

View File

@ -223,7 +223,9 @@ describe('Testing all functions.', () => {
jest.spyOn(arc,'sleep').mockImplementation();
jest.spyOn(fs, 'chmodSync').mockImplementation(() => {});
jest.spyOn(core, 'exportVariable').mockImplementation(() => {});
return arc.getArcKubeconfig().then(()=>{
await arc.getArcKubeconfig().catch(ex => {
throw new Error('Error: Could not get the KUBECONFIG for arc cluster: ' + ex);
});
expect(core.getInput).toBeCalledTimes(4);
expect(io.which).toHaveBeenCalledWith("az",true);
expect(arc.executeAzCliCommand).toHaveBeenNthCalledWith(1,`account show`, false);
@ -237,6 +239,5 @@ describe('Testing all functions.', () => {
expect(arc.sleep).toBeCalled();
expect(fs.chmodSync).toHaveBeenCalledWith(path.join('tempDirPath', 'kubeconfig_1234561234567'), '600');
expect(core.exportVariable).toHaveBeenCalledWith('KUBECONFIG', path.join('tempDirPath', 'kubeconfig_1234561234567'));
});
})
});