aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-04-07 10:53:35 +0200
committerChocobozzz <chocobozzz@cpy.re>2022-04-15 09:49:35 +0200
commit901bcf5c188ea79350fecd499ad76460b866617b (patch)
tree1e79f26cc3f2b952371d31bfa9b94a2b150be38a /server/tests/api/check-params
parentac907dc7c158056e9b6a5cb58acd27df5c7c2670 (diff)
downloadPeerTube-901bcf5c188ea79350fecd499ad76460b866617b.tar.gz
PeerTube-901bcf5c188ea79350fecd499ad76460b866617b.tar.zst
PeerTube-901bcf5c188ea79350fecd499ad76460b866617b.zip
Add ability to set start/end date to timeserie
Diffstat (limited to 'server/tests/api/check-params')
-rw-r--r--server/tests/api/check-params/views.ts48
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 })