import * as chai from 'chai'
import 'mocha'
-import { User, UserRole, Video } from '../../../../shared/index'
+import { User, UserRole, Video, MyUser, VideoPlaylistType } from '../../../../shared/index'
import {
blockUser,
cleanupTests,
it('Should be able to get user information', async function () {
const res1 = await getMyUserInformation(server.url, accessTokenUser)
- const userMe: User = res1.body
+ const userMe: MyUser = res1.body
const res2 = await getUserInformation(server.url, server.accessToken, userMe.id)
const userGet: User = res2.body
expect(userMe.adminFlags).to.be.undefined
expect(userGet.adminFlags).to.equal(UserAdminFlag.BY_PASS_VIDEO_AUTO_BLACKLIST)
+
+ expect(userMe.specialPlaylists).to.have.lengthOf(1)
+ expect(userMe.specialPlaylists[0].type).to.equal(VideoPlaylistType.WATCH_LATER)
})
})
expect(video.thumbnailPath).to.not.be.null
expect(video.previewPath).to.not.be.null
})
+
+ it('Should be able to search in my videos', async function () {
+ {
+ const res = await getMyVideos(server.url, accessTokenUser, 0, 5, '-createdAt', 'user video')
+ expect(res.body.total).to.equal(1)
+
+ const videos = res.body.data
+ expect(videos).to.have.lengthOf(1)
+ }
+
+ {
+ const res = await getMyVideos(server.url, accessTokenUser, 0, 5, '-createdAt', 'toto')
+ expect(res.body.total).to.equal(0)
+
+ const videos = res.body.data
+ expect(videos).to.have.lengthOf(0)
+ }
+ })
})
describe('Users listing', function () {
expect(user.autoPlayVideo).to.be.false
})
+ it('Should be able to change the autoPlayNextVideo attribute', async function () {
+ await updateMyUser({
+ url: server.url,
+ accessToken: accessTokenUser,
+ autoPlayNextVideo: true
+ })
+
+ const res = await getMyUserInformation(server.url, accessTokenUser)
+ const user = res.body
+
+ expect(user.autoPlayNextVideo).to.be.true
+ })
+
it('Should be able to change the email attribute', async function () {
await updateMyUser({
url: server.url,