Skip to content

Commit

Permalink
Merge pull request #25 from ckcr4lyf/feature/more-prom
Browse files Browse the repository at this point in the history
Stuffs and tests
  • Loading branch information
ckcr4lyf authored Feb 2, 2022
2 parents aefb7ca + cb09c72 commit 24cf7eb
Show file tree
Hide file tree
Showing 20 changed files with 7,750 additions and 473 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@

name: Node.js CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
on: [push, pull_request]

jobs:
build:
Expand All @@ -26,4 +22,5 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run build --if-present
- run: npm run test
- run: npm run build
37 changes: 37 additions & 0 deletions __tests__/helpers/preparePromMetrics.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { countTorrentStates } from '../../src/helpers/preparePromMetrics';
import { torrentFromApi } from '../../src/interfaces';

describe('countTorrentStates', () => {
it('Should count states correctly', () => {
let torrents = [
{
state: 'error'
},
{
state: 'error'
},
{
state: 'uploading'
},
{
state: 'downloading'
},
{
state: 'downloading'
},
{
state: 'downloading'
},
{
state: 'pausedUP'
},
] as unknown as torrentFromApi[];

const counted = countTorrentStates(torrents);
expect(counted.error).toEqual(2);
expect(counted.uploading).toEqual(1);
expect(counted.downloading).toEqual(3);
expect(counted.pausedUP).toEqual(1);
expect(counted.stalledDL).toEqual(0);
})
})
28 changes: 14 additions & 14 deletions build/add_torrent.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions build/check_qbit.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions build/discord/messages.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/helpers/backup.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions build/helpers/post_race_resume.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions build/helpers/pre_race.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 26 additions & 2 deletions build/helpers/preparePromMetrics.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/helpers/resume.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions build/interfaces.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/qbittorrent/auth.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 10 additions & 6 deletions build/server/app.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 24cf7eb

Please sign in to comment.