From 7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 13 Jul 2021 14:23:01 +0200 Subject: Introduce user command --- .../tests/api/notifications/notifications-api.ts | 25 +++++++++------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'server/tests/api/notifications/notifications-api.ts') diff --git a/server/tests/api/notifications/notifications-api.ts b/server/tests/api/notifications/notifications-api.ts index e5864f1c2..f33d8e64d 100644 --- a/server/tests/api/notifications/notifications-api.ts +++ b/server/tests/api/notifications/notifications-api.ts @@ -7,14 +7,13 @@ import { checkNewVideoFromSubscription, cleanupTests, getAllNotificationsSettings, - getMyUserInformation, MockSmtpServer, prepareNotificationsTest, ServerInfo, uploadRandomVideo, waitJobs } from '@shared/extra-utils' -import { User, UserNotification, UserNotificationSettingValue } from '@shared/models' +import { UserNotification, UserNotificationSettingValue } from '@shared/models' const expect = chai.expect @@ -109,15 +108,14 @@ describe('Test notifications API', function () { }) { - const res = await getMyUserInformation(server.url, userToken) - const info = res.body as User + const info = await server.usersCommand.getMyInfo({ token: userToken }) expect(info.notificationSettings.newVideoFromSubscription).to.equal(UserNotificationSettingValue.NONE) } const { name, uuid } = await uploadRandomVideo(server) const check = { web: true, mail: true } - await checkNewVideoFromSubscription({ ...baseParams, ...check }, name, uuid, 'absence') + await checkNewVideoFromSubscription({ ...baseParams, check }, name, uuid, 'absence') }) it('Should only have web notifications', async function () { @@ -129,8 +127,7 @@ describe('Test notifications API', function () { }) { - const res = await getMyUserInformation(server.url, userToken) - const info = res.body as User + const info = await server.usersCommand.getMyInfo({ token: userToken }) expect(info.notificationSettings.newVideoFromSubscription).to.equal(UserNotificationSettingValue.WEB) } @@ -138,12 +135,12 @@ describe('Test notifications API', function () { { const check = { mail: true, web: false } - await checkNewVideoFromSubscription({ ...baseParams, ...check }, name, uuid, 'absence') + await checkNewVideoFromSubscription({ ...baseParams, check }, name, uuid, 'absence') } { const check = { mail: false, web: true } - await checkNewVideoFromSubscription({ ...baseParams, ...check }, name, uuid, 'presence') + await checkNewVideoFromSubscription({ ...baseParams, check }, name, uuid, 'presence') } }) @@ -156,8 +153,7 @@ describe('Test notifications API', function () { }) { - const res = await getMyUserInformation(server.url, userToken) - const info = res.body as User + const info = await server.usersCommand.getMyInfo({ token: userToken }) expect(info.notificationSettings.newVideoFromSubscription).to.equal(UserNotificationSettingValue.EMAIL) } @@ -165,12 +161,12 @@ describe('Test notifications API', function () { { const check = { mail: false, web: true } - await checkNewVideoFromSubscription({ ...baseParams, ...check }, name, uuid, 'absence') + await checkNewVideoFromSubscription({ ...baseParams, check }, name, uuid, 'absence') } { const check = { mail: true, web: false } - await checkNewVideoFromSubscription({ ...baseParams, ...check }, name, uuid, 'presence') + await checkNewVideoFromSubscription({ ...baseParams, check }, name, uuid, 'presence') } }) @@ -186,8 +182,7 @@ describe('Test notifications API', function () { }) { - const res = await getMyUserInformation(server.url, userToken) - const info = res.body as User + const info = await server.usersCommand.getMyInfo({ token: userToken }) expect(info.notificationSettings.newVideoFromSubscription).to.equal( UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL ) -- cgit v1.2.3