-/* tslint:disable:no-unused-expression */
+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import * as chai from 'chai'
import 'mocha'
import {
+ cleanupTests,
createUser,
- flushTests,
+ flushAndRunServer,
getVideosListWithToken,
getVideoWithToken,
- killallServers, reRunServer,
- flushAndRunServer,
+ killallServers,
+ reRunServer,
searchVideoWithToken,
ServerInfo,
setAccessTokensToServers,
} from '../../../../shared/extra-utils'
import { Video, VideoDetails } from '../../../../shared/models/videos'
import { listMyVideosHistory, removeMyVideosHistory, userWatchVideo } from '../../../../shared/extra-utils/videos/video-history'
+import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
const expect = chai.expect
expect(res.body.data).to.have.lengthOf(0)
})
+ it('Should be able to search through videos in my history', async function () {
+ const res = await listMyVideosHistory(server.url, server.accessToken, '2')
+
+ expect(res.body.total).to.equal(1)
+
+ const videos: Video[] = res.body.data
+ expect(videos[0].name).to.equal('video 2')
+ })
+
it('Should clear my history', async function () {
await removeMyVideosHistory(server.url, server.accessToken, video3WatchedDate.toISOString())
})
videosHistoryEnabled: false
})
- await userWatchVideo(server.url, server.accessToken, video2UUID, 8, 409)
+ await userWatchVideo(server.url, server.accessToken, video2UUID, 8, HttpStatusCode.CONFLICT_409)
})
it('Should re-enable videos history', async function () {
expect(res.body.total).to.equal(0)
})
- after(function () {
- killallServers([ server ])
+ after(async function () {
+ await cleanupTests([ server ])
})
})