Skip to content

Commit eb89bc3

Browse files
authored
Split tests (lowlighter#88)
1 parent c9e530c commit eb89bc3

File tree

25 files changed

+575
-361
lines changed

25 files changed

+575
-361
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ This section explain how metrics is structured.
162162
* `fonts.css` contains additional fonts used to render metrics
163163
* `template.mjs` contains template source code
164164
* `tests/` contains tests
165-
* `testscases.js` contains tests case
166165
* `metrics.test.js` contains metrics testers
167166
* `Dockerfile` contains docker instructions used to build metrics image
168167
* `package.json` contains dependencies and command line aliases
@@ -576,7 +575,7 @@ json:
576575
577576
Creating tests for your plugin ensure that external changes don't break it.
578577
579-
You can define your tests cases in [`testscases.js`](/tests/testscases.js), which will automatically test your plugin with:
578+
You can define your tests cases in `tests.yml` in your plugin directory, which will automatically test your plugin with:
580579
- Metrics action
581580
- Metrics web instance
582581
- Metrics web instance placeholder (rendered by browser)

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,10 @@
4343
"devDependencies": {
4444
"jest": "^26.6.3",
4545
"libxmljs": "^0.19.7"
46+
},
47+
"jest": {
48+
"testEnvironment":"node",
49+
"testTimeout":60000,
50+
"transform":{}
4651
}
4752
}

source/plugins/activity/tests.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
- name: Activity plugin (default)
2+
uses: lowlighter/metrics@latest
3+
with:
4+
token: MOCKED_TOKEN
5+
plugin_activity: yes
6+
7+
- name: Activity plugin (filtered)
8+
uses: lowlighter/metrics@latest
9+
with:
10+
token: MOCKED_TOKEN
11+
plugin_activity: yes
12+
plugin_activity_filter: pr, issue
13+
14+
- name: Activity plugin (complete)
15+
uses: lowlighter/metrics@latest
16+
with:
17+
token: MOCKED_TOKEN
18+
plugin_activity: yes
19+
plugin_activity_limit: 100
20+
plugin_activity_days: 14
21+
plugin_activity_filter: all

source/plugins/anilist/tests.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
- name: Anilist plugin (default)
2+
uses: lowlighter/metrics@latest
3+
with:
4+
token: NOT_NEEDED
5+
plugin_anilist: yes
6+
7+
- name: Anilist plugin (manga only)
8+
uses: lowlighter/metrics@latest
9+
with:
10+
token: NOT_NEEDED
11+
plugin_anilist: yes
12+
plugin_anilist_medias: manga
13+
14+
- name: Anilist plugin (anime only)
15+
uses: lowlighter/metrics@latest
16+
with:
17+
token: NOT_NEEDED
18+
plugin_anilist: yes
19+
plugin_anilist_medias: anime
20+
21+
- name: Anilist plugin (favorites section)
22+
uses: lowlighter/metrics@latest
23+
with:
24+
token: NOT_NEEDED
25+
plugin_anilist: yes
26+
plugin_anilist_sections: favorites
27+
28+
- name: Anilist plugin (watching/reading section)
29+
uses: lowlighter/metrics@latest
30+
with:
31+
token: NOT_NEEDED
32+
plugin_anilist: yes
33+
plugin_anilist_sections: watching, reading
34+
35+
- name: Anilist plugin (characters section)
36+
uses: lowlighter/metrics@latest
37+
with:
38+
token: NOT_NEEDED
39+
plugin_anilist: yes
40+
plugin_anilist_sections: characters
41+
42+
- name: Anilist plugin (additional options)
43+
uses: lowlighter/metrics@latest
44+
with:
45+
token: NOT_NEEDED
46+
plugin_anilist: yes
47+
plugin_anilist_limit: 0
48+
plugin_anilist_shuffle: no
49+
plugin_anilist_user: user
50+
51+
- name: Anilist plugin (complete)
52+
uses: lowlighter/metrics@latest
53+
with:
54+
token: NOT_NEEDED
55+
plugin_anilist: yes
56+
plugin_anilist_medias: manga, anime
57+
plugin_anilist_sections: favorites, watching, reading, characters
58+
plugin_anilist_limit: 0
59+
plugin_anilist_shuffle: no
60+
plugin_anilist_user: user

source/plugins/base/tests.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
- name: Base (header)
2+
uses: lowlighter/metrics@latest
3+
with:
4+
token: MOCKED_TOKEN
5+
base: header
6+
base_header: yes # For web instance
7+
8+
- name: Base (activity)
9+
uses: lowlighter/metrics@latest
10+
with:
11+
token: MOCKED_TOKEN
12+
base: activity
13+
base_activity: yes # For web instance
14+
15+
- name: Base (community)
16+
uses: lowlighter/metrics@latest
17+
with:
18+
token: MOCKED_TOKEN
19+
base: community
20+
base_community: yes # For web instance
21+
22+
- name: Base (repositories)
23+
uses: lowlighter/metrics@latest
24+
with:
25+
token: MOCKED_TOKEN
26+
base: repositories
27+
base_repositories: yes # For web instance
28+
29+
- name: Base (metadata)
30+
uses: lowlighter/metrics@latest
31+
with:
32+
token: MOCKED_TOKEN
33+
base: metadata
34+
base_metadata: yes # For web instance
35+
36+
- name: Base (complete)
37+
uses: lowlighter/metrics@latest
38+
with:
39+
token: MOCKED_TOKEN
40+
base: header, activity, community, repositories, metadata
41+
base_header: yes # For web instance
42+
base_activity: yes # For web instance
43+
base_community: yes # For web instance
44+
base_repositories: yes # For web instance
45+
base_metadata: yes # For web instance

source/plugins/core/tests.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
- name: Image output (jpeg)
2+
uses: lowlighter/metrics@latest
3+
with:
4+
token: MOCKED_TOKEN
5+
config_output: jpeg
6+
7+
- name: Image output (png)
8+
uses: lowlighter/metrics@latest
9+
with:
10+
token: MOCKED_TOKEN
11+
config_output: png
12+
13+
- name: Disable animations
14+
uses: lowlighter/metrics@latest
15+
with:
16+
token: MOCKED_TOKEN
17+
config_animations: no
18+
19+
- name: Community templates
20+
uses: lowlighter/metrics@latest
21+
with:
22+
token: MOCKED_TOKEN
23+
template: "@classic"
24+
setup_community_templates: "lowlighter/metrics@master:classic"
25+
modes:
26+
- action

source/plugins/followup/tests.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
- name: Follow-up plugin (default)
2+
uses: lowlighter/metrics@latest
3+
with:
4+
token: MOCKED_TOKEN
5+
plugin_followup: yes

source/plugins/gists/tests.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
- name: Gists plugin (default)
2+
uses: lowlighter/metrics@latest
3+
with:
4+
token: MOCKED_TOKEN
5+
plugin_gists: yes

source/plugins/habits/tests.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
- name: Habits plugin (default)
2+
uses: lowlighter/metrics@latest
3+
with:
4+
token: MOCKED_TOKEN
5+
plugin_habits: yes
6+
7+
- name: Habits plugin (charts)
8+
uses: lowlighter/metrics@latest
9+
with:
10+
token: MOCKED_TOKEN
11+
plugin_habits: yes
12+
plugin_habits_facts: no
13+
plugin_habits_charts: yes
14+
config_timezone: Europe/Paris
15+
16+
- name: Habits plugin (facts)
17+
uses: lowlighter/metrics@latest
18+
with:
19+
token: MOCKED_TOKEN
20+
plugin_habits: yes
21+
plugin_habits_facts: yes
22+
23+
- name: Habits plugin (complete)
24+
uses: lowlighter/metrics@latest
25+
with:
26+
token: MOCKED_TOKEN
27+
plugin_habits: yes
28+
plugin_habits_facts: yes
29+
plugin_habits_charts: yes
30+
config_timezone: Europe/Paris
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
- name: Isocalendar plugin (default)
2+
uses: lowlighter/metrics@latest
3+
with:
4+
token: MOCKED_TOKEN
5+
plugin_isocalendar: yes
6+
7+
- name: Isocalendar plugin (half-year)
8+
uses: lowlighter/metrics@latest
9+
with:
10+
token: MOCKED_TOKEN
11+
plugin_isocalendar: yes
12+
plugin_isocalendar_duration: half-year
13+
14+
15+
- name: Isocalendar plugin (full-year)
16+
uses: lowlighter/metrics@latest
17+
with:
18+
token: MOCKED_TOKEN
19+
plugin_isocalendar: yes
20+
plugin_isocalendar_duration: full-year

0 commit comments

Comments
 (0)