Skip to content

Commit 4feccf7

Browse files
refactor: removes test
1 parent 18fd1d3 commit 4feccf7

2 files changed

Lines changed: 11 additions & 30 deletions

File tree

__tests__/main.test.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,5 @@
11
import {wait} from '../src/wait'
2-
import * as process from 'process'
3-
import * as cp from 'child_process'
4-
import * as path from 'path'
5-
62
test('throws invalid number', async () => {
73
const input = parseInt('foo', 10)
84
await expect(wait(input)).rejects.toThrow('milliseconds not a number')
95
})
10-
11-
test('wait 500 ms', async () => {
12-
const start = new Date()
13-
await wait(500)
14-
const end = new Date()
15-
var delta = Math.abs(end.getTime() - start.getTime())
16-
expect(delta).toBeGreaterThan(450)
17-
})
18-
19-
// shows how the runner will run a javascript action with env / stdout protocol
20-
test('test runs', () => {
21-
process.env['INPUT_MILLISECONDS'] = '500'
22-
const ip = path.join(__dirname, '..', 'lib', 'main.js')
23-
const options: cp.ExecSyncOptions = {
24-
env: process.env
25-
}
26-
console.log(cp.execSync(`node ${ip}`, options).toString())
27-
})

src/main.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
import GithubAPIClient from './services/github/GithubAPIClient'
22
import * as core from '@actions/core'
33
async function run(): Promise<void> {
4-
core.debug(
5-
JSON.stringify(
6-
await GithubAPIClient.getCollaboratorsNames({
7-
name: 'api_pt',
8-
owner: 'warrenbrasil'
9-
})
4+
try {
5+
core.debug(
6+
JSON.stringify(
7+
await GithubAPIClient.getCollaboratorsNames({
8+
name: 'api_pt',
9+
owner: 'warrenbrasil'
10+
})
11+
)
1012
)
11-
)
12-
return
13+
} catch (e) {
14+
throw e
15+
}
1316
}
1417

1518
run()

0 commit comments

Comments
 (0)