]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/notifications/notifications-api.ts
Merge remote-tracking branch 'weblate/develop' into release/5.0.0
[github/Chocobozzz/PeerTube.git] / server / tests / api / notifications / notifications-api.ts
index aeb73350bdf8f9f19b89dcdbedd58970a5b16b40..f194656c9f8b1eb684812e5f7b53489dd486b340 100644 (file)
@@ -1,20 +1,15 @@
 /* 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,
-  cleanupTests,
   getAllNotificationsSettings,
   MockSmtpServer,
-  PeerTubeServer,
-  prepareNotificationsTest,
-  waitJobs
-} from '@shared/server-commands'
+  prepareNotificationsTest
+} from '@server/tests/shared'
 import { UserNotification, UserNotificationSettingValue } from '@shared/models'
-
-const expect = chai.expect
+import { cleanupTests, PeerTubeServer, waitJobs } from '@shared/server-commands'
 
 describe('Test notifications API', function () {
   let server: PeerTubeServer
@@ -40,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 () {
@@ -91,7 +96,7 @@ describe('Test notifications API', function () {
 
     before(() => {
       baseParams = {
-        server: server,
+        server,
         emails,
         socketNotifications: userNotifications,
         token: userToken