Add test for favorite tasks
continuous-integration/drone/pr Build was killed Details

This commit is contained in:
kolaente 2020-09-05 21:56:12 +02:00
parent f2e4d3c516
commit 517fe4d6c6
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 18 additions and 0 deletions

View File

@ -8,6 +8,7 @@
created: 2018-12-01 01:12:04
updated: 2018-12-01 01:12:04
bucket_id: 1
is_favorite: true
- id: 2
title: 'task #2 done'
done: true
@ -140,6 +141,7 @@
list_id: 6
index: 1
bucket_id: 6
is_favorite: true
created: 2018-12-01 01:12:04
updated: 2018-12-01 01:12:04
- id: 16
@ -315,6 +317,7 @@
list_id: 20
index: 20
bucket_id: 5
is_favorite: true
created: 2018-12-01 01:12:04
updated: 2018-12-01 01:12:04
- id: 35

View File

@ -66,6 +66,7 @@ func TestTaskCollection_ReadAll(t *testing.T) {
CreatedBy: user1,
ListID: 1,
BucketID: 1,
IsFavorite: true,
Labels: []*Label{
{
ID: 4,
@ -288,6 +289,7 @@ func TestTaskCollection_ReadAll(t *testing.T) {
CreatedByID: 6,
CreatedBy: user6,
ListID: 6,
IsFavorite: true,
RelatedTasks: map[RelationKind][]*Task{},
BucketID: 6,
Created: time.Unix(1543626724, 0).In(loc),
@ -484,6 +486,7 @@ func TestTaskCollection_ReadAll(t *testing.T) {
Index: 1,
CreatedByID: 1,
ListID: 1,
IsFavorite: true,
Created: time.Unix(1543626724, 0).In(loc),
Updated: time.Unix(1543626724, 0).In(loc),
BucketID: 1,
@ -836,6 +839,18 @@ func TestTaskCollection_ReadAll(t *testing.T) {
},
wantErr: false,
},
{
name: "favorited tasks",
args: defaultArgs,
fields: fields{
ListID: FavoritesPseudoList.ID,
},
want: []*Task{
task1,
task15,
// Task 34 is also a favorite, but on a list user 1 has no access to.
},
},
}
for _, tt := range tests {