aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/notifications/notifications-api.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-16 09:04:35 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit89d241a79c262b9775c233b73cff080043ebb5e6 (patch)
treecb3b6cb431d25d891ef4e02f66c61d252d17048f /server/tests/api/notifications/notifications-api.ts
parentd23dd9fbfc4d26026352c10f81d2795ceaf2908a (diff)
downloadPeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.gz
PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.zst
PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.zip
Shorter server command names
Diffstat (limited to 'server/tests/api/notifications/notifications-api.ts')
-rw-r--r--server/tests/api/notifications/notifications-api.ts42
1 files changed, 21 insertions, 21 deletions
diff --git a/server/tests/api/notifications/notifications-api.ts b/server/tests/api/notifications/notifications-api.ts
index 41e1b8015..647d783b5 100644
--- a/server/tests/api/notifications/notifications-api.ts
+++ b/server/tests/api/notifications/notifications-api.ts
@@ -31,10 +31,10 @@ describe('Test notifications API', function () {
31 userNotifications = res.userNotifications 31 userNotifications = res.userNotifications
32 server = res.servers[0] 32 server = res.servers[0]
33 33
34 await server.subscriptionsCommand.add({ token: userToken, targetUri: 'root_channel@localhost:' + server.port }) 34 await server.subscriptions.add({ token: userToken, targetUri: 'root_channel@localhost:' + server.port })
35 35
36 for (let i = 0; i < 10; i++) { 36 for (let i = 0; i < 10; i++) {
37 await server.videosCommand.randomUpload({ wait: false }) 37 await server.videos.randomUpload({ wait: false })
38 } 38 }
39 39
40 await waitJobs([ server ]) 40 await waitJobs([ server ])
@@ -43,14 +43,14 @@ describe('Test notifications API', function () {
43 describe('Mark as read', function () { 43 describe('Mark as read', function () {
44 44
45 it('Should mark as read some notifications', async function () { 45 it('Should mark as read some notifications', async function () {
46 const { data } = await server.notificationsCommand.list({ token: userToken, start: 2, count: 3 }) 46 const { data } = await server.notifications.list({ token: userToken, start: 2, count: 3 })
47 const ids = data.map(n => n.id) 47 const ids = data.map(n => n.id)
48 48
49 await server.notificationsCommand.markAsRead({ token: userToken, ids }) 49 await server.notifications.markAsRead({ token: userToken, ids })
50 }) 50 })
51 51
52 it('Should have the notifications marked as read', async function () { 52 it('Should have the notifications marked as read', async function () {
53 const { data } = await server.notificationsCommand.list({ token: userToken, start: 0, count: 10 }) 53 const { data } = await server.notifications.list({ token: userToken, start: 0, count: 10 })
54 54
55 expect(data[0].read).to.be.false 55 expect(data[0].read).to.be.false
56 expect(data[1].read).to.be.false 56 expect(data[1].read).to.be.false
@@ -61,7 +61,7 @@ describe('Test notifications API', function () {
61 }) 61 })
62 62
63 it('Should only list read notifications', async function () { 63 it('Should only list read notifications', async function () {
64 const { data } = await server.notificationsCommand.list({ token: userToken, start: 0, count: 10, unread: false }) 64 const { data } = await server.notifications.list({ token: userToken, start: 0, count: 10, unread: false })
65 65
66 for (const notification of data) { 66 for (const notification of data) {
67 expect(notification.read).to.be.true 67 expect(notification.read).to.be.true
@@ -69,7 +69,7 @@ describe('Test notifications API', function () {
69 }) 69 })
70 70
71 it('Should only list unread notifications', async function () { 71 it('Should only list unread notifications', async function () {
72 const { data } = await server.notificationsCommand.list({ token: userToken, start: 0, count: 10, unread: true }) 72 const { data } = await server.notifications.list({ token: userToken, start: 0, count: 10, unread: true })
73 73
74 for (const notification of data) { 74 for (const notification of data) {
75 expect(notification.read).to.be.false 75 expect(notification.read).to.be.false
@@ -77,9 +77,9 @@ describe('Test notifications API', function () {
77 }) 77 })
78 78
79 it('Should mark as read all notifications', async function () { 79 it('Should mark as read all notifications', async function () {
80 await server.notificationsCommand.markAsReadAll({ token: userToken }) 80 await server.notifications.markAsReadAll({ token: userToken })
81 81
82 const body = await server.notificationsCommand.list({ token: userToken, start: 0, count: 10, unread: true }) 82 const body = await server.notifications.list({ token: userToken, start: 0, count: 10, unread: true })
83 83
84 expect(body.total).to.equal(0) 84 expect(body.total).to.equal(0)
85 expect(body.data).to.have.lengthOf(0) 85 expect(body.data).to.have.lengthOf(0)
@@ -101,17 +101,17 @@ describe('Test notifications API', function () {
101 it('Should not have notifications', async function () { 101 it('Should not have notifications', async function () {
102 this.timeout(20000) 102 this.timeout(20000)
103 103
104 await server.notificationsCommand.updateMySettings({ 104 await server.notifications.updateMySettings({
105 token: userToken, 105 token: userToken,
106 settings: { ...getAllNotificationsSettings(), newVideoFromSubscription: UserNotificationSettingValue.NONE } 106 settings: { ...getAllNotificationsSettings(), newVideoFromSubscription: UserNotificationSettingValue.NONE }
107 }) 107 })
108 108
109 { 109 {
110 const info = await server.usersCommand.getMyInfo({ token: userToken }) 110 const info = await server.users.getMyInfo({ token: userToken })
111 expect(info.notificationSettings.newVideoFromSubscription).to.equal(UserNotificationSettingValue.NONE) 111 expect(info.notificationSettings.newVideoFromSubscription).to.equal(UserNotificationSettingValue.NONE)
112 } 112 }
113 113
114 const { name, uuid } = await server.videosCommand.randomUpload() 114 const { name, uuid } = await server.videos.randomUpload()
115 115
116 const check = { web: true, mail: true } 116 const check = { web: true, mail: true }
117 await checkNewVideoFromSubscription({ ...baseParams, check }, name, uuid, 'absence') 117 await checkNewVideoFromSubscription({ ...baseParams, check }, name, uuid, 'absence')
@@ -120,17 +120,17 @@ describe('Test notifications API', function () {
120 it('Should only have web notifications', async function () { 120 it('Should only have web notifications', async function () {
121 this.timeout(20000) 121 this.timeout(20000)
122 122
123 await server.notificationsCommand.updateMySettings({ 123 await server.notifications.updateMySettings({
124 token: userToken, 124 token: userToken,
125 settings: { ...getAllNotificationsSettings(), newVideoFromSubscription: UserNotificationSettingValue.WEB } 125 settings: { ...getAllNotificationsSettings(), newVideoFromSubscription: UserNotificationSettingValue.WEB }
126 }) 126 })
127 127
128 { 128 {
129 const info = await server.usersCommand.getMyInfo({ token: userToken }) 129 const info = await server.users.getMyInfo({ token: userToken })
130 expect(info.notificationSettings.newVideoFromSubscription).to.equal(UserNotificationSettingValue.WEB) 130 expect(info.notificationSettings.newVideoFromSubscription).to.equal(UserNotificationSettingValue.WEB)
131 } 131 }
132 132
133 const { name, uuid } = await server.videosCommand.randomUpload() 133 const { name, uuid } = await server.videos.randomUpload()
134 134
135 { 135 {
136 const check = { mail: true, web: false } 136 const check = { mail: true, web: false }
@@ -146,17 +146,17 @@ describe('Test notifications API', function () {
146 it('Should only have mail notifications', async function () { 146 it('Should only have mail notifications', async function () {
147 this.timeout(20000) 147 this.timeout(20000)
148 148
149 await server.notificationsCommand.updateMySettings({ 149 await server.notifications.updateMySettings({
150 token: userToken, 150 token: userToken,
151 settings: { ...getAllNotificationsSettings(), newVideoFromSubscription: UserNotificationSettingValue.EMAIL } 151 settings: { ...getAllNotificationsSettings(), newVideoFromSubscription: UserNotificationSettingValue.EMAIL }
152 }) 152 })
153 153
154 { 154 {
155 const info = await server.usersCommand.getMyInfo({ token: userToken }) 155 const info = await server.users.getMyInfo({ token: userToken })
156 expect(info.notificationSettings.newVideoFromSubscription).to.equal(UserNotificationSettingValue.EMAIL) 156 expect(info.notificationSettings.newVideoFromSubscription).to.equal(UserNotificationSettingValue.EMAIL)
157 } 157 }
158 158
159 const { name, uuid } = await server.videosCommand.randomUpload() 159 const { name, uuid } = await server.videos.randomUpload()
160 160
161 { 161 {
162 const check = { mail: false, web: true } 162 const check = { mail: false, web: true }
@@ -172,7 +172,7 @@ describe('Test notifications API', function () {
172 it('Should have email and web notifications', async function () { 172 it('Should have email and web notifications', async function () {
173 this.timeout(20000) 173 this.timeout(20000)
174 174
175 await server.notificationsCommand.updateMySettings({ 175 await server.notifications.updateMySettings({
176 token: userToken, 176 token: userToken,
177 settings: { 177 settings: {
178 ...getAllNotificationsSettings(), 178 ...getAllNotificationsSettings(),
@@ -181,13 +181,13 @@ describe('Test notifications API', function () {
181 }) 181 })
182 182
183 { 183 {
184 const info = await server.usersCommand.getMyInfo({ token: userToken }) 184 const info = await server.users.getMyInfo({ token: userToken })
185 expect(info.notificationSettings.newVideoFromSubscription).to.equal( 185 expect(info.notificationSettings.newVideoFromSubscription).to.equal(
186 UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL 186 UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL
187 ) 187 )
188 } 188 }
189 189
190 const { name, uuid } = await server.videosCommand.randomUpload() 190 const { name, uuid } = await server.videos.randomUpload()
191 191
192 await checkNewVideoFromSubscription(baseParams, name, uuid, 'presence') 192 await checkNewVideoFromSubscription(baseParams, name, uuid, 'presence')
193 }) 193 })