MCPcopy Index your code
hub / github.com/google-github-actions/setup-gcloud / defaultMocks

Function defaultMocks

tests/setup-gcloud.test.ts:34–81  ·  view source on GitHub ↗
(
  m: typeof mock,
  overrideInputs?: Record<string, string>,
)

Source from the content-addressed store, hash-verified

32};
33
34const defaultMocks = (
35 m: typeof mock,
36 overrideInputs?: Record<string, string>,
37): Record<string, any> => {
38 const inputs = Object.assign({}, fakeInputs, overrideInputs);
39 return {
40 startGroup: m.method(core, 'startGroup', () => {}),
41 endGroup: m.method(core, 'endGroup', () => {}),
42 group: m.method(core, 'group', () => {}),
43 logDebug: m.method(core, 'debug', () => {}),
44 logError: m.method(core, 'error', () => {}),
45 logInfo: m.method(core, 'info', () => {}),
46 logNotice: m.method(core, 'notice', () => {}),
47 logWarning: m.method(core, 'warning', () => {}),
48 exportVariable: m.method(core, 'exportVariable', () => {}),
49 setSecret: m.method(core, 'setSecret', () => {}),
50 addPath: m.method(core, 'addPath', () => {}),
51 setOutput: m.method(core, 'setOutput', () => {}),
52 setFailed: m.method(core, 'setFailed', (msg: string) => {
53 throw new Error(msg);
54 }),
55 getBooleanInput: m.method(core, 'getBooleanInput', (name: string) => {
56 return !!inputs[name];
57 }),
58 getMultilineInput: m.method(core, 'getMultilineInput', (name: string) => {
59 return inputs[name];
60 }),
61 getInput: m.method(core, 'getInput', (name: string) => {
62 return inputs[name];
63 }),
64
65 authenticateGcloudSDK: m.method(setupGcloud, 'authenticateGcloudSDK', () => {}),
66 isAuthenticated: m.method(setupGcloud, 'isAuthenticated', () => {}),
67 isInstalled: m.method(setupGcloud, 'isInstalled', () => {
68 return true;
69 }),
70 installGcloudSDK: m.method(setupGcloud, 'installGcloudSDK', async () => {
71 return '1.2.3';
72 }),
73 installComponent: m.method(setupGcloud, 'installComponent', () => {}),
74 setProject: m.method(setupGcloud, 'setProject', () => {}),
75 getLatestGcloudSDKVersion: m.method(setupGcloud, 'getLatestGcloudSDKVersion', () => {
76 return '1.2.3';
77 }),
78
79 writeFile: m.method(fs, 'writeFile', () => {}),
80 };
81};
82
83test('#run', { concurrency: true }, async (suite) => {
84 const originalEnv = Object.assign({}, process.env);

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected