/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
-import * as chai from 'chai'
import 'mocha'
+import * as chai from 'chai'
+import { HttpStatusCode } from '@shared/core-utils'
import {
cleanupTests,
createUser,
getVideoWithToken,
killallServers,
reRunServer,
- searchVideoWithToken,
ServerInfo,
setAccessTokensToServers,
updateMyUser,
uploadVideo,
userLogin,
wait
-} 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'
+} from '@shared/extra-utils'
+import { listMyVideosHistory, removeMyVideosHistory, userWatchVideo } from '@shared/extra-utils/videos/video-history'
+import { Video, VideoDetails } from '@shared/models'
const expect = chai.expect
}
{
- const res = await searchVideoWithToken(server.url, 'video', server.accessToken)
- videosOfVideos.push(res.body.data)
+ const body = await server.searchCommand.searchVideos({ token: server.accessToken, search: 'video' })
+ videosOfVideos.push(body.data)
}
for (const videos of videosOfVideos) {
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())
})