Skip to content

Commit b5cac86

Browse files
authored
Add testing action (#1)
1 parent a0acaea commit b5cac86

File tree

7 files changed

+732
-35
lines changed

7 files changed

+732
-35
lines changed

.github/workflows/pr_toolkit.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Apify PR toolkit
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
apify-pr-toolkit:
10+
runs-on: ubuntu-20.04
11+
steps:
12+
- name: clone local repository
13+
uses: actions/checkout@v2
14+
15+
- name: run PR toolkit console team
16+
uses: ./
17+
with:
18+
repo-token: ${{ secrets.GITHUB_TOKEN }}
19+
team-name: Platform
20+
team-members: drobnikj

__tests__/main.test.ts

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import {findMilestone} from '../src/main'
2+
3+
test('findMilestone', async () => {
4+
const milestones = [
5+
{
6+
"url": "",
7+
"id": 20,
8+
"number": 20,
9+
"title": "13th Sprint - Platform team",
10+
"description": "",
11+
"open_issues": 9,
12+
"closed_issues": 19,
13+
"state": "open",
14+
"created_at": "2021-05-10T07:53:55Z",
15+
"updated_at": "2021-05-24T12:13:32Z",
16+
"due_on": "2021-05-23T07:00:00Z",
17+
},
18+
{
19+
"url": "",
20+
"id": 19,
21+
"number": 19,
22+
"title": "13th Sprint - Console team",
23+
"description": "",
24+
"open_issues": 29,
25+
"closed_issues": 32,
26+
"state": "open",
27+
"created_at": "2021-05-10T06:56:49Z",
28+
"updated_at": "2021-05-24T11:30:52Z",
29+
"due_on": "2021-05-23T07:00:00Z",
30+
},
31+
{
32+
"url": "",
33+
"id": 21,
34+
"number": 21,
35+
"title": "14th Sprint - Console team",
36+
"description": "",
37+
"open_issues": 31,
38+
"closed_issues": 0,
39+
"state": "open",
40+
"created_at": "2021-05-24T05:29:20Z",
41+
"updated_at": "2021-05-24T13:48:01Z",
42+
"due_on": "2021-06-06T07:00:00Z",
43+
},
44+
{
45+
"url": "",
46+
"id": 22,
47+
"number": 22,
48+
"title": "14th Sprint - Platform team",
49+
"description": "",
50+
"open_issues": 15,
51+
"closed_issues": 0,
52+
"state": "open",
53+
"created_at": "2021-05-24T08:16:56Z",
54+
"updated_at": "2021-05-24T13:20:19Z",
55+
"due_on": "2021-06-06T07:00:00Z",
56+
}
57+
]
58+
const foundMilestone = findMilestone(milestones, 'Platform');
59+
// @ts-ignore
60+
expect(foundMilestone.title).toBe('14th Sprint - Platform team')
61+
})

dist/index.js

Lines changed: 22 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jest.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
clearMocks: true,
3+
moduleFileExtensions: ['js', 'ts'],
4+
testEnvironment: 'node',
5+
testMatch: ['**/*.test.ts'],
6+
testRunner: 'jest-circus/runner',
7+
transform: {
8+
'^.+\\.ts$': 'ts-jest'
9+
},
10+
verbose: true
11+
}

0 commit comments

Comments
 (0)