Skip to content

Commit

Permalink
Replace equals with asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszgyg committed Mar 10, 2023
1 parent c2ea7c7 commit 7046a11
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions server/store/datastore/task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package datastore

import (
"reflect"
"testing"

"github.com/stretchr/testify/assert"
Expand All @@ -39,19 +38,10 @@ func TestTaskList(t *testing.T) {
t.Error(err)
return
}
if got, want := len(list), 1; got != want {
t.Errorf("Want %d task, got %d", want, got)
return
}
if got, want := list[0].ID, "some_random_id"; got != want {
t.Errorf("Want task id %s, got %s", want, got)
}
if got, want := list[0].Data, "foo"; string(got) != want {
t.Errorf("Want task data %s, got %s", want, string(got))
}
if got, want := list[0].DepStatus, map[string]string{"test": "dep"}; !reflect.DeepEqual(got, want) {
t.Errorf("Want task data %s, got %s", want, got)
}
assert.Len(t, list, 1, "Expected one task in list")
assert.EqualValues(t, "some_random_id", list[0].ID)
assert.EqualValues(t, "foo", list[0].Data)
assert.EqualValues(t, map[string]string{"test": "dep"}, list[0].DepStatus)

err = store.TaskDelete("some_random_id")
if err != nil {
Expand All @@ -64,7 +54,5 @@ func TestTaskList(t *testing.T) {
t.Error(err)
return
}
if got, want := len(list), 0; got != want {
t.Errorf("Want empty task list after delete")
}
assert.Len(t, list, 0, "Want empty task list after delete")
}

0 comments on commit 7046a11

Please sign in to comment.