createUser,
doubleFollow,
flushAndRunMultipleServers,
- getUserNotifications,
getVideosList,
getVideosListWithToken,
ServerInfo,
setAccessTokensToServers,
uploadVideo,
- userLogin,
waitJobs
} from '@shared/extra-utils'
-import { UserNotification, UserNotificationType, Video } from '@shared/models'
+import { UserNotificationType, Video } from '@shared/models'
const expect = chai.expect
await waitJobs([ mainServer, comment.server ])
- const res = await getUserNotifications(mainServer.url, mainServer.accessToken, 0, 30)
- const commentNotifications = (res.body.data as UserNotification[])
- .filter(n => n.comment && n.comment.video.uuid === comment.videoUUID && n.createdAt >= createdAt)
+ const { data } = await mainServer.notificationsCommand.list({ start: 0, count: 30 })
+ const commentNotifications = data.filter(n => n.comment && n.comment.video.uuid === comment.videoUUID && n.createdAt >= createdAt)
if (check === 'presence') expect(commentNotifications).to.have.lengthOf(1)
else expect(commentNotifications).to.have.lengthOf(0)
const user = { username: 'user1', password: 'password' }
await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: user.username, password: user.password })
- userToken1 = await userLogin(servers[0], user)
+ userToken1 = await servers[0].loginCommand.getAccessToken(user)
await uploadVideo(servers[0].url, userToken1, { name: 'video user 1' })
}
const user = { username: 'moderator', password: 'password' }
await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: user.username, password: user.password })
- userModeratorToken = await userLogin(servers[0], user)
+ userModeratorToken = await servers[0].loginCommand.getAccessToken(user)
}
{
const user = { username: 'user2', password: 'password' }
await createUser({ url: servers[1].url, accessToken: servers[1].accessToken, username: user.username, password: user.password })
- userToken2 = await userLogin(servers[1], user)
+ userToken2 = await servers[1].loginCommand.getAccessToken(user)
await uploadVideo(servers[1].url, userToken2, { name: 'video user 2' })
}
await waitJobs(servers)
- const res = await getUserNotifications(servers[0].url, servers[0].accessToken, 0, 30)
- const commentNotifications = (res.body.data as UserNotification[])
- .filter(n => {
- return n.type === UserNotificationType.NEW_INSTANCE_FOLLOWER &&
- n.createdAt >= now.toISOString()
- })
+ const { data } = await servers[0].notificationsCommand.list({ start: 0, count: 30 })
+ const commentNotifications = data.filter(n => {
+ return n.type === UserNotificationType.NEW_INSTANCE_FOLLOWER && n.createdAt >= now.toISOString()
+ })
expect(commentNotifications).to.have.lengthOf(0)
}
await waitJobs(servers)
- const res = await getUserNotifications(servers[0].url, servers[0].accessToken, 0, 30)
- const commentNotifications = (res.body.data as UserNotification[])
- .filter(n => {
- return n.type === UserNotificationType.NEW_INSTANCE_FOLLOWER &&
- n.createdAt >= now.toISOString()
- })
+ const { data } = await servers[0].notificationsCommand.list({ start: 0, count: 30 })
+ const commentNotifications = data.filter(n => {
+ return n.type === UserNotificationType.NEW_INSTANCE_FOLLOWER && n.createdAt >= now.toISOString()
+ })
expect(commentNotifications).to.have.lengthOf(1)
}