Skip to content

Commit eb89bc3

Browse files
authoredFeb 1, 2021
Split tests (#88)
1 parent c9e530c commit eb89bc3

File tree

25 files changed

+575
-361
lines changed

25 files changed

+575
-361
lines changed
 

‎CONTRIBUTING.md

+1-2
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

+5
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

+21
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

+60
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

+45
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

+26
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

+5
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

+5
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

+30
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

‎source/plugins/isocalendar/tests.yml

+20
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

‎source/plugins/languages/tests.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
- name: Language plugin (default)
2+
uses: lowlighter/metrics@latest
3+
with:
4+
token: MOCKED_TOKEN
5+
plugin_languages: yes
6+
7+
- name: Language plugin (ignored languages)
8+
uses: lowlighter/metrics@latest
9+
with:
10+
token: MOCKED_TOKEN
11+
plugin_languages: yes
12+
plugin_languages_ignored: html, css, dockerfile
13+
14+
15+
- name: Language plugin (skipped repositories)
16+
uses: lowlighter/metrics@latest
17+
with:
18+
token: MOCKED_TOKEN
19+
plugin_languages: yes
20+
plugin_languages_skipped: metrics
21+
22+
- name: Language plugin (custom color set)
23+
uses: lowlighter/metrics@latest
24+
with:
25+
token: MOCKED_TOKEN
26+
plugin_languages: yes
27+
plugin_languages_colors: complementary
28+
29+
- name: Language plugin (with details)
30+
uses: lowlighter/metrics@latest
31+
with:
32+
token: MOCKED_TOKEN
33+
plugin_languages: yes
34+
plugin_languages_details: percentage
35+
36+
- name: Language plugin (complete)
37+
uses: lowlighter/metrics@latest
38+
with:
39+
token: MOCKED_TOKEN
40+
plugin_languages: yes
41+
plugin_languages_ignored: html, css, dockerfile
42+
plugin_languages_skipped: metrics
43+
plugin_languages_colors: rainbow
44+
plugin_languages_details: bytes-size, percentage

‎source/plugins/lines/tests.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
- name: Lines plugin (default)
2+
uses: lowlighter/metrics@latest
3+
with:
4+
token: MOCKED_TOKEN
5+
base: repositories
6+
plugin_lines: yes
7+

‎source/plugins/music/tests.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
- name: Music plugin (playlist - apple)
2+
uses: lowlighter/metrics@latest
3+
with:
4+
token: NOT_NEEDED
5+
plugin_music: yes
6+
plugin_music_playlist: https://embed.music.apple.com/fr/playlist/usr-share/pl.u-V9D7m8Etjmjd0D
7+
8+
- name: Music plugin (playlist - spotify)
9+
uses: lowlighter/metrics@latest
10+
with:
11+
token: NOT_NEEDED
12+
plugin_music: yes
13+
plugin_music_playlist: https://open.spotify.com/embed/playlist/3nfA87oeJw4LFVcUDjRcqi
14+
15+
- name: Music plugin (recent - spotify)
16+
uses: lowlighter/metrics@latest
17+
with:
18+
token: NOT_NEEDED
19+
plugin_music_token: MOCKED_CLIENT_ID, MOCKED_CLIENT_SECRET, MOCKED_REFRESH_TOKEN
20+
plugin_music: yes
21+
plugin_music_provider: spotify
22+
23+
- name: Music plugin (recent - lastfm)
24+
uses: lowlighter/metrics@latest
25+
with:
26+
token: NOT_NEEDED
27+
plugin_music_token: MOCKED_TOKEN
28+
plugin_music: yes
29+
plugin_music_provider: lastfm
30+
plugin_music_user: RJ

‎source/plugins/pagespeed/tests.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
- name: PageSpeed plugin (default)
2+
uses: lowlighter/metrics@latest
3+
with:
4+
token: MOCKED_TOKEN
5+
plugin_pagespeed_token: MOCKED_TOKEN
6+
plugin_pagespeed: yes
7+
8+
- name: PageSpeed plugin (different url)
9+
uses: lowlighter/metrics@latest
10+
with:
11+
token: NOT_NEEDED
12+
plugin_pagespeed_token: MOCKED_TOKEN
13+
plugin_pagespeed: yes
14+
plugin_pagespeed_url: github.com
15+
16+
- name: PageSpeed plugin (detailed)
17+
uses: lowlighter/metrics@latest
18+
with:
19+
token: NOT_NEEDED
20+
plugin_pagespeed_token: MOCKED_TOKEN
21+
plugin_pagespeed: yes
22+
plugin_pagespeed_detailed: yes
23+
24+
- name: PageSpeed plugin (screenshot)
25+
uses: lowlighter/metrics@latest
26+
with:
27+
token: NOT_NEEDED
28+
plugin_pagespeed_token: MOCKED_TOKEN
29+
plugin_pagespeed: yes
30+
plugin_pagespeed_screenshot: yes
31+
32+
- name: PageSpeed plugin (complete)
33+
uses: lowlighter/metrics@latest
34+
with:
35+
token: NOT_NEEDED
36+
plugin_pagespeed_token: MOCKED_TOKEN
37+
plugin_pagespeed: yes
38+
plugin_pagespeed_detailed: yes
39+
plugin_pagespeed_screenshot: yes

0 commit comments

Comments
 (0)
Failed to load comments.