1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 10:19:35 +02:00

Add ability to set start/end date to timeserie

This commit is contained in:
Chocobozzz 2022-04-07 10:53:35 +02:00 committed by Chocobozzz
parent ac907dc7c1
commit 901bcf5c18
12 changed files with 296 additions and 22 deletions

View file

@ -112,6 +112,54 @@ describe('Test videos views', function () {
await servers[0].videoStats.getTimeserieStats({ videoId, metric: 'hello' as any, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
})
it('Should fail with an invalid start date', async function () {
await servers[0].videoStats.getTimeserieStats({
videoId,
metric: 'viewers',
startDate: 'fake' as any,
endDate: new Date(),
expectedStatus: HttpStatusCode.BAD_REQUEST_400
})
})
it('Should fail with an invalid end date', async function () {
await servers[0].videoStats.getTimeserieStats({
videoId,
metric: 'viewers',
startDate: new Date(),
endDate: 'fake' as any,
expectedStatus: HttpStatusCode.BAD_REQUEST_400
})
})
it('Should fail if start date is specified but not end date', async function () {
await servers[0].videoStats.getTimeserieStats({
videoId,
metric: 'viewers',
startDate: new Date(),
expectedStatus: HttpStatusCode.BAD_REQUEST_400
})
})
it('Should fail if end date is specified but not start date', async function () {
await servers[0].videoStats.getTimeserieStats({
videoId,
metric: 'viewers',
endDate: new Date(),
expectedStatus: HttpStatusCode.BAD_REQUEST_400
})
})
it('Should fail with a too big interval', async function () {
await servers[0].videoStats.getTimeserieStats({
videoId,
metric: 'viewers',
startDate: new Date('2021-04-07T08:31:57.126Z'),
endDate: new Date(),
expectedStatus: HttpStatusCode.BAD_REQUEST_400
})
})
it('Should succeed with the correct parameters', async function () {
await servers[0].videoStats.getTimeserieStats({ videoId, metric: 'viewers' })
})