Add more tests
This commit is contained in:
parent
1f278297f8
commit
9efa699e7b
@ -8,6 +8,7 @@
|
||||
created: 2018-12-01 01:12:04
|
||||
updated: 2018-12-01 01:12:04
|
||||
bucket_id: 1
|
||||
position: 2
|
||||
- id: 2
|
||||
title: 'task #2 done'
|
||||
done: true
|
||||
@ -17,6 +18,7 @@
|
||||
created: 2018-12-01 01:12:04
|
||||
updated: 2018-12-01 01:12:04
|
||||
bucket_id: 1
|
||||
position: 4
|
||||
- id: 3
|
||||
title: 'task #3 high prio'
|
||||
done: false
|
||||
|
@ -87,7 +87,8 @@ func TestBucket_ReadAll(t *testing.T) {
|
||||
|
||||
buckets := bucketsInterface.([]*Bucket)
|
||||
assert.Len(t, buckets, 3)
|
||||
assert.Equal(t, int64(2), buckets[0].Tasks[0].ID)
|
||||
assert.Equal(t, int64(2), buckets[0].Tasks[1].ID)
|
||||
assert.Equal(t, int64(33), buckets[0].Tasks[0].ID)
|
||||
})
|
||||
t.Run("accessed by link share", func(t *testing.T) {
|
||||
db.LoadAndAssertFixtures(t)
|
||||
|
@ -90,6 +90,7 @@ func TestTaskCollection_ReadAll(t *testing.T) {
|
||||
ListID: 1,
|
||||
BucketID: 1,
|
||||
IsFavorite: true,
|
||||
Position: 2,
|
||||
Labels: []*Label{
|
||||
label4,
|
||||
},
|
||||
@ -160,6 +161,7 @@ func TestTaskCollection_ReadAll(t *testing.T) {
|
||||
CreatedBy: user1,
|
||||
ListID: 1,
|
||||
BucketID: 1,
|
||||
Position: 4,
|
||||
Labels: []*Label{
|
||||
label4,
|
||||
},
|
||||
@ -517,6 +519,7 @@ func TestTaskCollection_ReadAll(t *testing.T) {
|
||||
Created: time.Unix(1543626724, 0).In(loc),
|
||||
Updated: time.Unix(1543626724, 0).In(loc),
|
||||
BucketID: 1,
|
||||
Position: 2,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -1033,6 +1036,51 @@ func TestTaskCollection_ReadAll(t *testing.T) {
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "order by position",
|
||||
fields: fields{
|
||||
SortBy: []string{"position", "id"},
|
||||
OrderBy: []string{"asc", "asc"},
|
||||
},
|
||||
args: args{
|
||||
a: &user.User{ID: 1},
|
||||
},
|
||||
want: []*Task{
|
||||
// the other ones don't have a position set
|
||||
task3,
|
||||
task4,
|
||||
task5,
|
||||
task6,
|
||||
task7,
|
||||
task8,
|
||||
task9,
|
||||
task10,
|
||||
task11,
|
||||
task12,
|
||||
task15,
|
||||
task16,
|
||||
task17,
|
||||
task18,
|
||||
task19,
|
||||
task20,
|
||||
task21,
|
||||
task22,
|
||||
task23,
|
||||
task24,
|
||||
task25,
|
||||
task26,
|
||||
task27,
|
||||
task28,
|
||||
task29,
|
||||
task30,
|
||||
task31,
|
||||
task32,
|
||||
task33,
|
||||
// The only tasks with a position set
|
||||
task1,
|
||||
task2,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
Loading…
x
Reference in New Issue
Block a user