-
Notifications
You must be signed in to change notification settings - Fork 2
fix: resolve test issues and standardize date formats #13
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,7 @@ func (c ClippingItem) MarshalJSON() ([]byte, error) { | |
| CreatedAt string `json:"createdAt"` | ||
| }{ | ||
| Alias: (*Alias)(&c), | ||
| CreatedAt: c.CreatedAt.UTC().Format(time.RFC3339), | ||
| CreatedAt: c.CreatedAt.UTC().Format("2006-01-02T15:04:05+00:00"), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This custom date format string is duplicated on line 64. To improve maintainability and avoid using 'magic strings', consider defining it as a package-level constant. For example, you could add this at the top of the file: const RFC3339Custom = "2006-01-02T15:04:05+00:00"And then use it here and on line 64: CreatedAt: c.CreatedAt.UTC().Format(RFC3339Custom),This makes the code cleaner and easier to update if the format needs to change in the future. |
||
| }) | ||
| } | ||
|
|
||
|
|
@@ -61,7 +61,7 @@ func (c ClippingItem) ToClippingInput() ClippingInput { | |
| Content: c.Content, | ||
| BookID: "0", // Default book ID | ||
| PageAt: c.PageAt, | ||
| CreatedAt: c.CreatedAt.UTC().Format(time.RFC3339), | ||
| CreatedAt: c.CreatedAt.UTC().Format("2006-01-02T15:04:05+00:00"), | ||
| Source: "kindle", | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This slice of test cases is duplicated in
TestParseFixturesJSON(lines 230-234). To reduce code duplication and make the tests easier to maintain, consider defining this slice as a single package-level variable that both test functions can share.For example, you could define this at the top of your test file:
Then, both
TestParseAllFixturesandTestParseFixturesJSONcan simply iterate overfixtureTestCases.