@@ -127,47 +127,47 @@ describe('/notification/notifications', () => {
127127 projectId : project . id ,
128128 userId : testUser . id ,
129129 templateId : template . id ,
130- eventType : 'test event 1 ' ,
130+ eventType : 'reportCreated ' ,
131131 } ) ;
132132
133133 pun2 = await db . models . notification . create ( {
134134 ident : uuidv4 ( ) ,
135135 projectId : project . id ,
136136 userId : user01 . id ,
137137 templateId : template . id ,
138- eventType : 'test event 2 ' ,
138+ eventType : 'reportCreated ' ,
139139 } ) ;
140140
141141 pun3 = await db . models . notification . create ( {
142142 ident : uuidv4 ( ) ,
143143 projectId : project2 . id ,
144144 userId : user01 . id ,
145145 templateId : template . id ,
146- eventType : 'test event 3 ' ,
146+ eventType : 'reportCreated ' ,
147147 } ) ;
148148
149149 pun4 = await db . models . notification . create ( {
150150 ident : uuidv4 ( ) ,
151151 projectId : project . id ,
152152 userGroupId : userGroup1 . id ,
153153 templateId : template . id ,
154- eventType : 'test event 1 ' ,
154+ eventType : 'reportCreated ' ,
155155 } ) ;
156156
157157 pun5 = await db . models . notification . create ( {
158158 ident : uuidv4 ( ) ,
159159 projectId : project . id ,
160160 userGroupId : userGroup2 . id ,
161161 templateId : template . id ,
162- eventType : 'test event 2 ' ,
162+ eventType : 'reportCreated ' ,
163163 } ) ;
164164
165165 pun6 = await db . models . notification . create ( {
166166 ident : uuidv4 ( ) ,
167167 projectId : project2 . id ,
168168 userGroupId : userGroup1 . id ,
169169 templateId : template . id ,
170- eventType : 'test event 3 ' ,
170+ eventType : 'reportCreated ' ,
171171 } ) ;
172172 } ) ;
173173
@@ -194,10 +194,9 @@ describe('/notification/notifications', () => {
194194 describe ( 'GET' , ( ) => {
195195 test ( '/ - project ident - 200 Success' , async ( ) => {
196196 const res = await request
197- . get ( ' /api/notification/notifications' )
197+ . get ( ` /api/notification/notifications?project= ${ project . ident } ` )
198198 . auth ( username , password )
199199 . type ( 'json' )
200- . send ( { project : project . ident } )
201200 . expect ( HTTP_STATUS . OK ) ;
202201
203202 expect ( Array . isArray ( res . body ) ) . toBe ( true ) ;
@@ -210,10 +209,9 @@ describe('/notification/notifications', () => {
210209
211210 test ( '/ - user group ident - 200 Success' , async ( ) => {
212211 const res = await request
213- . get ( ' /api/notification/notifications' )
212+ . get ( ` /api/notification/notifications?user_group= ${ userGroup1 . ident } ` )
214213 . auth ( username , password )
215214 . type ( 'json' )
216- . send ( { user_group : userGroup1 . ident } )
217215 . expect ( HTTP_STATUS . OK ) ;
218216
219217 expect ( Array . isArray ( res . body ) ) . toBe ( true ) ;
@@ -223,10 +221,9 @@ describe('/notification/notifications', () => {
223221
224222 test ( '/ - user ident - 200 Success' , async ( ) => {
225223 const res = await request
226- . get ( ' /api/notification/notifications' )
224+ . get ( ` /api/notification/notifications?user= ${ user01 . ident } ` )
227225 . auth ( username , password )
228226 . type ( 'json' )
229- . send ( { user : user01 . ident } )
230227 . expect ( HTTP_STATUS . OK ) ;
231228
232229 expect ( Array . isArray ( res . body ) ) . toBe ( true ) ;
@@ -236,10 +233,9 @@ describe('/notification/notifications', () => {
236233
237234 test ( '/ - project and user ident - 200 Success' , async ( ) => {
238235 const res = await request
239- . get ( ' /api/notification/notifications' )
236+ . get ( ` /api/notification/notifications?user= ${ user01 . ident } &project= ${ project . ident } ` )
240237 . auth ( username , password )
241238 . type ( 'json' )
242- . send ( { user : user01 . ident , project : project . ident } )
243239 . expect ( HTTP_STATUS . OK ) ;
244240
245241 expect ( Array . isArray ( res . body ) ) . toBe ( true ) ;
@@ -249,10 +245,9 @@ describe('/notification/notifications', () => {
249245
250246 test ( '/ - project and user group ident - 200 Success' , async ( ) => {
251247 const res = await request
252- . get ( ' /api/notification/notifications' )
248+ . get ( ` /api/notification/notifications?user_group= ${ userGroup1 . ident } &project= ${ project . ident } ` )
253249 . auth ( username , password )
254250 . type ( 'json' )
255- . send ( { user_group : userGroup1 . ident , project : project . ident } )
256251 . expect ( HTTP_STATUS . OK ) ;
257252
258253 expect ( Array . isArray ( res . body ) ) . toBe ( true ) ;
@@ -262,28 +257,25 @@ describe('/notification/notifications', () => {
262257
263258 test ( '/ - user ident - 404 user not found' , async ( ) => {
264259 await request
265- . get ( ' /api/notification/notifications' )
260+ . get ( ` /api/notification/notifications?user= ${ uuidv4 ( ) } ` )
266261 . auth ( username , password )
267262 . type ( 'json' )
268- . send ( { user : uuidv4 ( ) } )
269263 . expect ( HTTP_STATUS . NOT_FOUND ) ;
270264 } ) ;
271265
272266 test ( '/ - project ident - 404 project not found' , async ( ) => {
273267 await request
274- . get ( ' /api/notification/notifications' )
268+ . get ( ` /api/notification/notifications?project= ${ uuidv4 ( ) } ` )
275269 . auth ( username , password )
276270 . type ( 'json' )
277- . send ( { project : uuidv4 ( ) } )
278271 . expect ( HTTP_STATUS . NOT_FOUND ) ;
279272 } ) ;
280273
281274 test ( '/ - user group ident - 404 user group not found' , async ( ) => {
282275 await request
283- . get ( ' /api/notification/notifications' )
276+ . get ( ` /api/notification/notifications?user_group= ${ uuidv4 ( ) } ` )
284277 . auth ( username , password )
285278 . type ( 'json' )
286- . send ( { user_group : uuidv4 ( ) } )
287279 . expect ( HTTP_STATUS . NOT_FOUND ) ;
288280 } ) ;
289281 } ) ;
0 commit comments