-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
Stuffs and tests
- Loading branch information
There are no files selected for viewing
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); | ||
}) | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.