From 20b1cac458fb0691890bf631373d600593891102 Mon Sep 17 00:00:00 2001 From: Atharva Mulmuley Date: Thu, 3 Jun 2021 12:11:44 +0530 Subject: [PATCH] added arc test for run method --- __tests__/run.test.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/__tests__/run.test.ts b/__tests__/run.test.ts index bd4b9906..1909c5cb 100644 --- a/__tests__/run.test.ts +++ b/__tests__/run.test.ts @@ -1,4 +1,5 @@ import * as run from '../src/login' +import * as arc from '../src/arc-login' import * as os from 'os'; import * as io from '@actions/io'; import * as toolCache from '@actions/tool-cache'; @@ -197,4 +198,14 @@ describe('Testing all functions.', () => { expect(fs.chmodSync).toHaveBeenCalledWith(path.join('tempDirPath', 'kubeconfig_1234561234567'), '600'); expect(core.exportVariable).toHaveBeenCalledWith('KUBECONFIG', path.join('tempDirPath', 'kubeconfig_1234561234567')); }); + + test('run() - check if arc scenario is getting triggered', async () =>{ + jest.spyOn(arc,'getArcKubeconfig').mockImplementation(); + jest.spyOn(core, 'getInput').mockImplementation((inputName, options) => { + if (inputName == 'cluster-type') return 'arc'; + }); + expect(run.run()); + expect(arc.getArcKubeconfig).toBeCalled(); + }); + });