Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue graphql.Time unmarshal time check #432 #438

Closed
wants to merge 6 commits into from

Conversation

panikgaul
Copy link

Now we can use both unix timestamps:

t.UnmarshalGraphQL(time.Now().UnixNano())
t.UnmarshalGraphQL(time.Now().Unix())

In case of large unix nanosecond timestamp split them to second and nanosecond part
time check for unix nanoseconds
@pavelnikolov
Copy link
Member

pavelnikolov commented Mar 22, 2021

Can you, please, add unit tests and I'd be happy to merge this PR. Feel free to create a time_test.go file in the root folder.

André Gorschkow and others added 2 commits March 23, 2021 14:36
@panikgaul
Copy link
Author

Can you, please, add unit tests and I'd be happy to merge this PR. Feel free to create a time_test.go file in the root folder.

Of course, I added a couple of tests, the coverage of time_test.go should be 100% now.

time_test.go Outdated
time.Now().Unix(),
time.Now().UnixNano(),
float64(-1),
"2006-01-02T15:04:05Z",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you, pelase, check the expected values too? So that each test has got, want pair. This way you will not only check that marshalling and unmarshalling work but also that they return what you expect.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I wouldn't use time.Now() instead I prefer constants, please

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I added the checks for expeced values with assertion library and remove time.Now() usage.
Can you please check if it is ok for you, Thx!

@pavelnikolov
Copy link
Member

@panikgaul could you, please, check the results too in the tests?

André Gorschkow and others added 2 commits April 9, 2021 09:52
@pavelnikolov
Copy link
Member

pavelnikolov commented Apr 12, 2021

@panikgaul I'm ready to merge this PR, but I don't want testify as part of the library's dependencies. You only use two of it's methods, so it doesn't really bring any significant value. Thank you for your understanding and I'm sorry for delaying the merge.

@pavelnikolov
Copy link
Member

@panikgaul are your intentions to remove testify and continue working on this PR?

@pavelnikolov
Copy link
Member

#486 solves this problem. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants