Created
August 22, 2019 18:04
-
-
Save teivah/865afd2d31a59c2bdd69e354a6b14b85 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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