]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/notifications/notifications-api.ts
Shorter server command names
[github/Chocobozzz/PeerTube.git] / server / tests / api / notifications / notifications-api.ts
index 41e1b801521c0281cedd70ba83c03511d29eb40a..647d783b54e055894844db116405a6c86c404ff0 100644 (file)
@@ -31,10 +31,10 @@ describe('Test notifications API', function () {
     userNotifications = res.userNotifications
     server = res.servers[0]
 
-    await server.subscriptionsCommand.add({ token: userToken, targetUri: 'root_channel@localhost:' + server.port })
+    await server.subscriptions.add({ token: userToken, targetUri: 'root_channel@localhost:' + server.port })
 
     for (let i = 0; i < 10; i++) {
-      await server.videosCommand.randomUpload({ wait: false })
+      await server.videos.randomUpload({ wait: false })
     }
 
     await waitJobs([ server ])
@@ -43,14 +43,14 @@ describe('Test notifications API', function () {
   describe('Mark as read', function () {
 
     it('Should mark as read some notifications', async function () {
-      const { data } = await server.notificationsCommand.list({ token: userToken, start: 2, count: 3 })
+      const { data } = await server.notifications.list({ token: userToken, start: 2, count: 3 })
       const ids = data.map(n => n.id)
 
-      await server.notificationsCommand.markAsRead({ token: userToken, ids })
+      await server.notifications.markAsRead({ token: userToken, ids })
     })
 
     it('Should have the notifications marked as read', async function () {
-      const { data } = await server.notificationsCommand.list({ token: userToken, start: 0, count: 10 })
+      const { data } = await server.notifications.list({ token: userToken, start: 0, count: 10 })
 
       expect(data[0].read).to.be.false
       expect(data[1].read).to.be.false
@@ -61,7 +61,7 @@ describe('Test notifications API', function () {
     })
 
     it('Should only list read notifications', async function () {
-      const { data } = await server.notificationsCommand.list({ token: userToken, start: 0, count: 10, unread: false })
+      const { data } = await server.notifications.list({ token: userToken, start: 0, count: 10, unread: false })
 
       for (const notification of data) {
         expect(notification.read).to.be.true
@@ -69,7 +69,7 @@ describe('Test notifications API', function () {
     })
 
     it('Should only list unread notifications', async function () {
-      const { data } = await server.notificationsCommand.list({ token: userToken, start: 0, count: 10, unread: true })
+      const { data } = await server.notifications.list({ token: userToken, start: 0, count: 10, unread: true })
 
       for (const notification of data) {
         expect(notification.read).to.be.false
@@ -77,9 +77,9 @@ describe('Test notifications API', function () {
     })
 
     it('Should mark as read all notifications', async function () {
-      await server.notificationsCommand.markAsReadAll({ token: userToken })
+      await server.notifications.markAsReadAll({ token: userToken })
 
-      const body = await server.notificationsCommand.list({ token: userToken, start: 0, count: 10, unread: true })
+      const body = await server.notifications.list({ token: userToken, start: 0, count: 10, unread: true })
 
       expect(body.total).to.equal(0)
       expect(body.data).to.have.lengthOf(0)
@@ -101,17 +101,17 @@ describe('Test notifications API', function () {
     it('Should not have notifications', async function () {
       this.timeout(20000)
 
-      await server.notificationsCommand.updateMySettings({
+      await server.notifications.updateMySettings({
         token: userToken,
         settings: { ...getAllNotificationsSettings(), newVideoFromSubscription: UserNotificationSettingValue.NONE }
       })
 
       {
-        const info = await server.usersCommand.getMyInfo({ token: userToken })
+        const info = await server.users.getMyInfo({ token: userToken })
         expect(info.notificationSettings.newVideoFromSubscription).to.equal(UserNotificationSettingValue.NONE)
       }
 
-      const { name, uuid } = await server.videosCommand.randomUpload()
+      const { name, uuid } = await server.videos.randomUpload()
 
       const check = { web: true, mail: true }
       await checkNewVideoFromSubscription({ ...baseParams, check }, name, uuid, 'absence')
@@ -120,17 +120,17 @@ describe('Test notifications API', function () {
     it('Should only have web notifications', async function () {
       this.timeout(20000)
 
-      await server.notificationsCommand.updateMySettings({
+      await server.notifications.updateMySettings({
         token: userToken,
         settings: { ...getAllNotificationsSettings(), newVideoFromSubscription: UserNotificationSettingValue.WEB }
       })
 
       {
-        const info = await server.usersCommand.getMyInfo({ token: userToken })
+        const info = await server.users.getMyInfo({ token: userToken })
         expect(info.notificationSettings.newVideoFromSubscription).to.equal(UserNotificationSettingValue.WEB)
       }
 
-      const { name, uuid } = await server.videosCommand.randomUpload()
+      const { name, uuid } = await server.videos.randomUpload()
 
       {
         const check = { mail: true, web: false }
@@ -146,17 +146,17 @@ describe('Test notifications API', function () {
     it('Should only have mail notifications', async function () {
       this.timeout(20000)
 
-      await server.notificationsCommand.updateMySettings({
+      await server.notifications.updateMySettings({
         token: userToken,
         settings: { ...getAllNotificationsSettings(), newVideoFromSubscription: UserNotificationSettingValue.EMAIL }
       })
 
       {
-        const info = await server.usersCommand.getMyInfo({ token: userToken })
+        const info = await server.users.getMyInfo({ token: userToken })
         expect(info.notificationSettings.newVideoFromSubscription).to.equal(UserNotificationSettingValue.EMAIL)
       }
 
-      const { name, uuid } = await server.videosCommand.randomUpload()
+      const { name, uuid } = await server.videos.randomUpload()
 
       {
         const check = { mail: false, web: true }
@@ -172,7 +172,7 @@ describe('Test notifications API', function () {
     it('Should have email and web notifications', async function () {
       this.timeout(20000)
 
-      await server.notificationsCommand.updateMySettings({
+      await server.notifications.updateMySettings({
         token: userToken,
         settings: {
           ...getAllNotificationsSettings(),
@@ -181,13 +181,13 @@ describe('Test notifications API', function () {
       })
 
       {
-        const info = await server.usersCommand.getMyInfo({ token: userToken })
+        const info = await server.users.getMyInfo({ token: userToken })
         expect(info.notificationSettings.newVideoFromSubscription).to.equal(
           UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL
         )
       }
 
-      const { name, uuid } = await server.videosCommand.randomUpload()
+      const { name, uuid } = await server.videos.randomUpload()
 
       await checkNewVideoFromSubscription(baseParams, name, uuid, 'presence')
     })