@@ -4495,6 +4495,7 @@ func (s *MethodTestSuite) TestNotifications() {
4495
4495
Title : "test title" ,
4496
4496
Content : "test content notification" ,
4497
4497
Icon : "test icon" ,
4498
+ Actions : json .RawMessage ("{}" ),
4498
4499
})
4499
4500
4500
4501
check .Args (u .ID ).Asserts (rbac .ResourceInboxNotification .WithID (notifID ).WithOwner (u .ID .String ()), policy .ActionRead ).Returns ([]database.InboxNotification {notif })
@@ -4517,6 +4518,7 @@ func (s *MethodTestSuite) TestNotifications() {
4517
4518
Title : "test title" ,
4518
4519
Content : "test content notification" ,
4519
4520
Icon : "test icon" ,
4521
+ Actions : json .RawMessage ("{}" ),
4520
4522
})
4521
4523
4522
4524
check .Args (u .ID ).Asserts (rbac .ResourceInboxNotification .WithID (notifID ).WithOwner (u .ID .String ()), policy .ActionRead ).Returns ([]database.InboxNotification {notif })
@@ -4542,6 +4544,7 @@ func (s *MethodTestSuite) TestNotifications() {
4542
4544
Title : "test title" ,
4543
4545
Content : "test content notification" ,
4544
4546
Icon : "test icon" ,
4547
+ Actions : json .RawMessage ("{}" ),
4545
4548
})
4546
4549
4547
4550
check .Args (database.FetchInboxNotificationsByUserIDFilteredByTemplatesAndTargetsParams {
@@ -4571,6 +4574,7 @@ func (s *MethodTestSuite) TestNotifications() {
4571
4574
Title : "test title" ,
4572
4575
Content : "test content notification" ,
4573
4576
Icon : "test icon" ,
4577
+ Actions : json .RawMessage ("{}" ),
4574
4578
})
4575
4579
4576
4580
check .Args (database.FetchUnreadInboxNotificationsByUserIDFilteredByTemplatesAndTargetsParams {
@@ -4600,14 +4604,34 @@ func (s *MethodTestSuite) TestNotifications() {
4600
4604
Title : "test title" ,
4601
4605
Content : "test content notification" ,
4602
4606
Icon : "test icon" ,
4607
+ Actions : json .RawMessage ("{}" ),
4603
4608
})
4604
4609
4605
4610
check .Args (notifID ).Asserts (rbac .ResourceInboxNotification .WithID (notifID ).WithOwner (u .ID .String ()), policy .ActionRead ).Returns (notif )
4606
4611
}))
4607
4612
4608
- s .Run ("InsertInboxNotification" , s .Subtest (func (_ database.Store , check * expects ) {
4609
- owner := uuid.UUID {}
4610
- check .Args (database.InsertInboxNotificationParams {}).Asserts (rbac .ResourceInboxNotification .WithOwner (owner .String ()), policy .ActionCreate )
4613
+ s .Run ("InsertInboxNotification" , s .Subtest (func (db database.Store , check * expects ) {
4614
+ u := dbgen .User (s .T (), db , database.User {})
4615
+ o := dbgen .Organization (s .T (), db , database.Organization {})
4616
+ tpl := dbgen .Template (s .T (), db , database.Template {
4617
+ OrganizationID : o .ID ,
4618
+ CreatedBy : u .ID ,
4619
+ })
4620
+
4621
+ notifID := uuid .New ()
4622
+
4623
+ targets := []uuid.UUID {u .ID , tpl .ID }
4624
+
4625
+ check .Args (database.InsertInboxNotificationParams {
4626
+ ID : notifID ,
4627
+ UserID : u .ID ,
4628
+ TemplateID : tpl .ID ,
4629
+ Targets : targets ,
4630
+ Title : "test title" ,
4631
+ Content : "test content notification" ,
4632
+ Icon : "test icon" ,
4633
+ Actions : json .RawMessage ("{}" ),
4634
+ }).Asserts (rbac .ResourceInboxNotification .WithOwner (u .ID .String ()), policy .ActionCreate )
4611
4635
}))
4612
4636
4613
4637
s .Run ("SetInboxNotificationAsRead" , s .Subtest (func (db database.Store , check * expects ) {
@@ -4631,6 +4655,7 @@ func (s *MethodTestSuite) TestNotifications() {
4631
4655
Title : "test title" ,
4632
4656
Content : "test content notification" ,
4633
4657
Icon : "test icon" ,
4658
+ Actions : json .RawMessage ("{}" ),
4634
4659
})
4635
4660
4636
4661
notif .ReadAt = sql.NullTime {Time : readAt , Valid : true }
0 commit comments