diff options
Diffstat (limited to 'server/tests/api/check-params/views.ts')
-rw-r--r-- | server/tests/api/check-params/views.ts | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/server/tests/api/check-params/views.ts b/server/tests/api/check-params/views.ts index ca4752345..3dba2a42e 100644 --- a/server/tests/api/check-params/views.ts +++ b/server/tests/api/check-params/views.ts | |||
@@ -112,6 +112,54 @@ describe('Test videos views', function () { | |||
112 | await servers[0].videoStats.getTimeserieStats({ videoId, metric: 'hello' as any, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) | 112 | await servers[0].videoStats.getTimeserieStats({ videoId, metric: 'hello' as any, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) |
113 | }) | 113 | }) |
114 | 114 | ||
115 | it('Should fail with an invalid start date', async function () { | ||
116 | await servers[0].videoStats.getTimeserieStats({ | ||
117 | videoId, | ||
118 | metric: 'viewers', | ||
119 | startDate: 'fake' as any, | ||
120 | endDate: new Date(), | ||
121 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 | ||
122 | }) | ||
123 | }) | ||
124 | |||
125 | it('Should fail with an invalid end date', async function () { | ||
126 | await servers[0].videoStats.getTimeserieStats({ | ||
127 | videoId, | ||
128 | metric: 'viewers', | ||
129 | startDate: new Date(), | ||
130 | endDate: 'fake' as any, | ||
131 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 | ||
132 | }) | ||
133 | }) | ||
134 | |||
135 | it('Should fail if start date is specified but not end date', async function () { | ||
136 | await servers[0].videoStats.getTimeserieStats({ | ||
137 | videoId, | ||
138 | metric: 'viewers', | ||
139 | startDate: new Date(), | ||
140 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 | ||
141 | }) | ||
142 | }) | ||
143 | |||
144 | it('Should fail if end date is specified but not start date', async function () { | ||
145 | await servers[0].videoStats.getTimeserieStats({ | ||
146 | videoId, | ||
147 | metric: 'viewers', | ||
148 | endDate: new Date(), | ||
149 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 | ||
150 | }) | ||
151 | }) | ||
152 | |||
153 | it('Should fail with a too big interval', async function () { | ||
154 | await servers[0].videoStats.getTimeserieStats({ | ||
155 | videoId, | ||
156 | metric: 'viewers', | ||
157 | startDate: new Date('2021-04-07T08:31:57.126Z'), | ||
158 | endDate: new Date(), | ||
159 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 | ||
160 | }) | ||
161 | }) | ||
162 | |||
115 | it('Should succeed with the correct parameters', async function () { | 163 | it('Should succeed with the correct parameters', async function () { |
116 | await servers[0].videoStats.getTimeserieStats({ videoId, metric: 'viewers' }) | 164 | await servers[0].videoStats.getTimeserieStats({ videoId, metric: 'viewers' }) |
117 | }) | 165 | }) |