Skip to content

Commit 0d0e4c7

Browse files
committed
new method
1 parent 9351f0d commit 0d0e4c7

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/run.test.ts

+15-15
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ describe('Testing all functions in run file.', () => {
9090

9191
expect(await run.getStableKubectlVersion()).toBe('v1.20.4')
9292
expect(toolCache.downloadTool).toBeCalled()
93-
expect(fs.readFileSync).toBeCalledWith('pathToTool', 'utf8')
93+
expect(fs.readFileSync).toHaveBeenCalledWith('pathToTool', 'utf8')
9494
})
9595

9696
test('getStableKubectlVersion() - return default v1.15.0 if version read is empty', async () => {
@@ -101,7 +101,7 @@ describe('Testing all functions in run file.', () => {
101101

102102
expect(await run.getStableKubectlVersion()).toBe('v1.15.0')
103103
expect(toolCache.downloadTool).toBeCalled()
104-
expect(fs.readFileSync).toBeCalledWith('pathToTool', 'utf8')
104+
expect(fs.readFileSync).toHaveBeenCalledWith('pathToTool', 'utf8')
105105
})
106106

107107
test('getStableKubectlVersion() - return default v1.15.0 if unable to download file', async () => {
@@ -127,11 +127,11 @@ describe('Testing all functions in run file.', () => {
127127
expect(await run.downloadKubectl('v1.15.0')).toBe(
128128
path.join('pathToCachedTool', 'kubectl.exe')
129129
)
130-
expect(toolCache.find).toBeCalledWith('kubectl', 'v1.15.0')
130+
expect(toolCache.find).toHaveBeenCalledWith('kubectl', 'v1.15.0')
131131
expect(toolCache.downloadTool).toBeCalled()
132132
expect(toolCache.cacheFile).toBeCalled()
133133
expect(os.type).toBeCalled()
134-
expect(fs.chmodSync).toBeCalledWith(
134+
expect(fs.chmodSync).toHaveBeenCalledWith(
135135
path.join('pathToCachedTool', 'kubectl.exe'),
136136
'775'
137137
)
@@ -146,7 +146,7 @@ describe('Testing all functions in run file.', () => {
146146
await expect(run.downloadKubectl('v1.15.0')).rejects.toThrow(
147147
'DownloadKubectlFailed'
148148
)
149-
expect(toolCache.find).toBeCalledWith('kubectl', 'v1.15.0')
149+
expect(toolCache.find).toHaveBeenCalledWith('kubectl', 'v1.15.0')
150150
expect(toolCache.downloadTool).toBeCalled()
151151
})
152152

@@ -168,7 +168,7 @@ describe('Testing all functions in run file.', () => {
168168
)
169169
)
170170
expect(os.arch).toBeCalled()
171-
expect(toolCache.find).toBeCalledWith('kubectl', kubectlVersion)
171+
expect(toolCache.find).toHaveBeenCalledWith('kubectl', kubectlVersion)
172172
expect(toolCache.downloadTool).toBeCalled()
173173
})
174174

@@ -181,9 +181,9 @@ describe('Testing all functions in run file.', () => {
181181
expect(await run.downloadKubectl('v1.15.0')).toBe(
182182
path.join('pathToCachedTool', 'kubectl.exe')
183183
)
184-
expect(toolCache.find).toBeCalledWith('kubectl', 'v1.15.0')
184+
expect(toolCache.find).toHaveBeenCalledWith('kubectl', 'v1.15.0')
185185
expect(os.type).toBeCalled()
186-
expect(fs.chmodSync).toBeCalledWith(
186+
expect(fs.chmodSync).toHaveBeenCalledWith(
187187
path.join('pathToCachedTool', 'kubectl.exe'),
188188
'775'
189189
)
@@ -200,9 +200,9 @@ describe('Testing all functions in run file.', () => {
200200
jest.spyOn(core, 'setOutput').mockImplementation()
201201

202202
expect(await run.run()).toBeUndefined()
203-
expect(core.getInput).toBeCalledWith('version', {required: true})
204-
expect(core.addPath).toBeCalledWith('pathToCachedTool')
205-
expect(core.setOutput).toBeCalledWith(
203+
expect(core.getInput).toHaveBeenCalledWith('version', {required: true})
204+
expect(core.addPath).toHaveBeenCalledWith('pathToCachedTool')
205+
expect(core.setOutput).toHaveBeenCalledWith(
206206
'kubectl-path',
207207
path.join('pathToCachedTool', 'kubectl.exe')
208208
)
@@ -222,12 +222,12 @@ describe('Testing all functions in run file.', () => {
222222
jest.spyOn(core, 'setOutput').mockImplementation()
223223

224224
expect(await run.run()).toBeUndefined()
225-
expect(toolCache.downloadTool).toBeCalledWith(
225+
expect(toolCache.downloadTool).toHaveBeenCalledWith(
226226
'https://storage.googleapis.com/kubernetes-release/release/stable.txt'
227227
)
228-
expect(core.getInput).toBeCalledWith('version', {required: true})
229-
expect(core.addPath).toBeCalledWith('pathToCachedTool')
230-
expect(core.setOutput).toBeCalledWith(
228+
expect(core.getInput).toHaveBeenCalledWith('version', {required: true})
229+
expect(core.addPath).toHaveBeenCalledWith('pathToCachedTool')
230+
expect(core.setOutput).toHaveBeenCalledWith(
231231
'kubectl-path',
232232
path.join('pathToCachedTool', 'kubectl.exe')
233233
)

0 commit comments

Comments
 (0)