forked from carimura/github-pages-deploy-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexecute.test.ts
36 lines (30 loc) · 864 Bytes
/
execute.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import {execute, stdout} from '../src/execute'
import {exec} from '@actions/exec'
jest.mock('@actions/exec', () => ({
exec: jest.fn()
}))
describe('execute', () => {
it('should be called with the correct arguments when silent mode is enabled', async () => {
stdout('hello')
await execute('echo Montezuma', './', true)
expect(exec).toBeCalledWith('echo Montezuma', [], {
cwd: './',
silent: true,
listeners: {
stdout: expect.any(Function)
}
})
})
it('should not silence the input when action.silent is false', async () => {
process.env['RUNNER_DEBUG'] = '1'
stdout('hello')
await execute('echo Montezuma', './', false)
expect(exec).toBeCalledWith('echo Montezuma', [], {
cwd: './',
silent: false,
listeners: {
stdout: expect.any(Function)
}
})
})
})