Skip to content

Commit 36e53da

Browse files
committed
fix: comparison method #4
1 parent a23e248 commit 36e53da

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

testfiles/a/tests/task_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func compareTask(t *testing.T, expected, actual *task.Task) {
4141
t.Fatalf("unexpected id: %d(expected: %d)", actual.ID, expected.ID)
4242
}
4343

44-
if actual.Created != expected.Created {
44+
if !actual.Created.Equal(expected.Created) {
4545
t.Fatalf("unexpected time: %s(expected: %s)", actual.Created, expected.Created)
4646
}
4747

@@ -68,7 +68,7 @@ func TestDatastoreListTask(t *testing.T) {
6868
}
6969
}()
7070

71-
now := time.Unix(time.Now().Unix(), 0)
71+
now := time.Now()
7272
desc := "Hello, World!"
7373

7474
tks := make([]*task.Task, 0)
@@ -147,7 +147,7 @@ func TestDatastoreListNameWithIndexes(t *testing.T) {
147147
}
148148
}()
149149

150-
now := time.Unix(time.Now().Unix(), 0)
150+
now := time.Now()
151151
desc := "Hello, World!"
152152
desc2 := "Prefix, Test!"
153153

@@ -269,7 +269,7 @@ func TestDatastore(t *testing.T) {
269269
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
270270
defer cancel()
271271

272-
now := time.Unix(time.Now().Unix(), 0)
272+
now := time.Now()
273273
desc := "hello"
274274

275275
id, err := taskRepo.Insert(ctx, &task.Task{

testfiles/b/tests/task_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func compareTask(t *testing.T, expected, actual *task.Task) {
4040
t.Fatalf("unexpected id: %s(expected: %s)", actual.ID, expected.ID)
4141
}
4242

43-
if actual.Created != expected.Created {
43+
if !actual.Created.Equal(expected.Created) {
4444
t.Fatalf("unexpected time: %s(expected: %s)", actual.Created, expected.Created)
4545
}
4646

@@ -61,7 +61,7 @@ func TestDatastore(t *testing.T) {
6161
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
6262
defer cancel()
6363

64-
now := time.Unix(time.Now().Unix(), 0)
64+
now := time.Now()
6565
desc := "hello"
6666

6767
id, err := taskRepo.Insert(ctx, &task.Task{

testfiles/c/tests/task_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func compareTask(t *testing.T, expected, actual *task.Task) {
4040
t.Fatalf("unexpected id: %s(expected: %s)", actual.ID, expected.ID)
4141
}
4242

43-
if actual.Created != expected.Created {
43+
if !actual.Created.Equal(expected.Created) {
4444
t.Fatalf("unexpected time: %s(expected: %s)", actual.Created, expected.Created)
4545
}
4646

@@ -61,7 +61,7 @@ func TestDatastore(t *testing.T) {
6161
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
6262
defer cancel()
6363

64-
now := time.Unix(time.Now().Unix(), 0)
64+
now := time.Now()
6565
desc := "hello"
6666

6767
incmplKey := datastore.IncompleteKey("Task", nil)

0 commit comments

Comments
 (0)