- await makePutBodyRequest({ url: server.url, path, fields, token: server.accessToken, statusCodeExpected: 204 })
+ describe('When removing all user videos history', function () {
+ it('Should fail with an unauthenticated user', async function () {
+ await makePostBodyRequest({ url: server.url, path: myHistoryPath + '/remove', expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
+ })
+
+ it('Should fail with a bad beforeDate parameter', async function () {
+ const body = { beforeDate: '15' }
+ await makePostBodyRequest({
+ url: server.url,
+ token: server.accessToken,
+ path: myHistoryRemove,
+ fields: body,
+ expectedStatus: HttpStatusCode.BAD_REQUEST_400
+ })
+ })
+
+ it('Should succeed with a valid beforeDate param', async function () {
+ const body = { beforeDate: new Date().toISOString() }
+ await makePostBodyRequest({
+ url: server.url,
+ token: server.accessToken,
+ path: myHistoryRemove,
+ fields: body,
+ expectedStatus: HttpStatusCode.NO_CONTENT_204
+ })
+ })
+
+ it('Should succeed without body', async function () {
+ await makePostBodyRequest({
+ url: server.url,
+ token: server.accessToken,
+ path: myHistoryRemove,
+ expectedStatus: HttpStatusCode.NO_CONTENT_204
+ })