[notifications] adopt strict zod types and extend test coverage (#36049)

* [notifications] adopt strict zod types and extend test coverage

* [notifications] validate expires date via schema

GitOrigin-RevId: 25dee0578ec443447e4c38a50a7e6c8b44831fe7
This commit is contained in:
Jakob Ackermann
2026-09-17 11:45:58 +00:00
committed by Copybot
parent eb36edac6d
commit f48132a70e
7 changed files with 413 additions and 29 deletions
@@ -104,18 +104,22 @@ describe('Notifications Controller', () => {
modifiedCount: 1,
upsertedCount: 0,
})
// addNotification's body schema is a strictObject that does not
// include user_id (it's only ever read from params) -- drop it here
// to match, same as every real caller (web's NotificationsHandler).
const { user_id: _user_id, ...notification } = stubbedNotification[0]
const req = {
params: {
user_id: userId,
},
body: stubbedNotification[0],
body: notification,
}
await new Promise<void>(resolve => {
controller.addNotification(req, {
sendStatus: code => {
expect(Notifications.addNotification).toHaveBeenCalledWith(
userId,
stubbedNotification[0]
notification
)
expect(code).toBe(200)
resolve()