Skip to content

Commit

Permalink
fix time race in scalar test
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathaniel Caza committed Jun 25, 2018
1 parent a80b720 commit b04846f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion example/scalars/scalar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ func TestScalars(t *testing.T) {
fragment UserData on User { id name created tier address { location } }`, &resp)

require.Equal(t, "1,2", resp.User.Address.Location)
require.Equal(t, time.Now().Unix(), resp.User.Created)
// There can be a delay between creation and test assertion, so we
// give some leeway to eliminate false positives.S
require.WithinDuration(t, time.Now(), time.Unix(resp.User.Created, 0), 5*time.Second)
require.Equal(t, "6,66", resp.Search[0].Address.Location)
require.Equal(t, int64(666), resp.Search[0].Created)
require.Equal(t, "A", resp.Search[0].Tier)
Expand Down

0 comments on commit b04846f

Please sign in to comment.