X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fnotifications%2Fnotifications-api.ts;h=f194656c9f8b1eb684812e5f7b53489dd486b340;hb=c2fba93a60e3352e68c50e40f8fe0db684129fe9;hp=ac08449f898cf58ed703f9404be93dec5a4c1cc7;hpb=c55e3d7227fe1453869e309025996b9d75256d5d;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/notifications/notifications-api.ts b/server/tests/api/notifications/notifications-api.ts index ac08449f8..f194656c9 100644 --- a/server/tests/api/notifications/notifications-api.ts +++ b/server/tests/api/notifications/notifications-api.ts @@ -1,7 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import 'mocha' -import * as chai from 'chai' +import { expect } from 'chai' import { CheckerBaseParams, checkNewVideoFromSubscription, @@ -12,8 +11,6 @@ import { import { UserNotification, UserNotificationSettingValue } from '@shared/models' import { cleanupTests, PeerTubeServer, waitJobs } from '@shared/server-commands' -const expect = chai.expect - describe('Test notifications API', function () { let server: PeerTubeServer let userNotifications: UserNotification[] = [] @@ -38,6 +35,16 @@ describe('Test notifications API', function () { await waitJobs([ server ]) }) + describe('Notification list & count', function () { + + it('Should correctly list notifications', async function () { + const { data, total } = await server.notifications.list({ token: userToken, start: 0, count: 2 }) + + expect(data).to.have.lengthOf(2) + expect(total).to.equal(10) + }) + }) + describe('Mark as read', function () { it('Should mark as read some notifications', async function () { @@ -89,7 +96,7 @@ describe('Test notifications API', function () { before(() => { baseParams = { - server: server, + server, emails, socketNotifications: userNotifications, token: userToken