X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=server%2Ftests%2Fapi%2Fcheck-params%2Fviews.ts;h=fe037b1455ba709cda296e229c61dbcaf1c798e3;hb=49f0468d44468528c2fb2c8b0efd19cdaeeec43d;hp=3dba2a42e59dbb151eac3118a0fbca491698d53c;hpb=f18a060a83d7053897173b2a24fb7984893131c7;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/check-params/views.ts b/server/tests/api/check-params/views.ts index 3dba2a42e..fe037b145 100644 --- a/server/tests/api/check-params/views.ts +++ b/server/tests/api/check-params/views.ts @@ -75,8 +75,30 @@ describe('Test videos views', function () { }) }) + it('Should fail with an invalid start date', async function () { + await servers[0].videoStats.getOverallStats({ + videoId, + startDate: 'fake' as any, + endDate: new Date().toISOString(), + expectedStatus: HttpStatusCode.BAD_REQUEST_400 + }) + }) + + it('Should fail with an invalid end date', async function () { + await servers[0].videoStats.getOverallStats({ + videoId, + startDate: new Date().toISOString(), + endDate: 'fake' as any, + expectedStatus: HttpStatusCode.BAD_REQUEST_400 + }) + }) + it('Should succeed with the correct parameters', async function () { - await servers[0].videoStats.getOverallStats({ videoId }) + await servers[0].videoStats.getOverallStats({ + videoId, + startDate: new Date().toISOString(), + endDate: new Date().toISOString() + }) }) })