Skip to content

Instantly share code, notes, and snippets.

@teivah
Created August 22, 2019 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teivah/865afd2d31a59c2bdd69e354a6b14b85 to your computer and use it in GitHub Desktop.
Save teivah/865afd2d31a59c2bdd69e354a6b14b85 to your computer and use it in GitHub Desktop.
func Test_duration(t *testing.T) {
oldNow := now
defer func() {now = oldNow}()
now = func() time.Time {
current, _ := time.Parse(time.RFC3339, "2000-01-08T20:00:00.000Z")
return current
}
expected, _ := time.Parse(time.RFC3339, "2000-01-08T21:00:00.000Z")
assert.Equal(t, duration(time.Hour), expected)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment