-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathGetAllNotificationsByUser.test.ts
More file actions
28 lines (23 loc) · 1.01 KB
/
Copy pathGetAllNotificationsByUser.test.ts
File metadata and controls
28 lines (23 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { ApiConfig, getAllNotificationsByUser, Notification } from '../../../src'
import { TestConstants } from '../../testHelpers/TestConstants'
import { DataverseApiAuthMechanism } from '../../../src/core/infra/repositories/ApiConfig'
describe('execute', () => {
beforeEach(async () => {
ApiConfig.init(
TestConstants.TEST_API_URL,
DataverseApiAuthMechanism.API_KEY,
process.env.TEST_API_KEY
)
})
test('should successfully return notifications for authenticated user', async () => {
const notifications: Notification[] = await getAllNotificationsByUser.execute()
expect(notifications).not.toBeNull()
expect(Array.isArray(notifications)).toBe(true)
})
test('should have correct notification properties if notifications exist', async () => {
const notifications = await getAllNotificationsByUser.execute()
expect(notifications[0]).toHaveProperty('id')
expect(notifications[0]).toHaveProperty('type')
expect(notifications[0]).toHaveProperty('sentTimestamp')
})
})