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

add headers to webhook data #108

Merged
merged 4 commits into from
Jan 8, 2025
Merged

add headers to webhook data #108

merged 4 commits into from
Jan 8, 2025

Conversation

IvanKiral
Copy link
Contributor

Motivation

Which issue does this fix? Fixes #issue number

If no issue exists, what is the fix or new feature? Were there any reasons to fix/implement things that are not obvious?

Checklist

  • Code follows coding conventions held in this repo
  • Automated tests have been added
  • Tests are passing
  • Docs have been updated (if applicable)
  • Temporary settings (e.g. variables used during development and testing) have been reverted to defaults

How to test

If manual testing is required, what are the steps?

src/utils/files.ts Outdated Show resolved Hide resolved
@IvanKiral IvanKiral force-pushed the fix_webhooks_headers branch 2 times, most recently from 3f9e1d2 to d3bfb97 Compare January 7, 2025 11:42
@JiriLojda JiriLojda force-pushed the fix_webhooks_headers branch from 368365a to 683b3e2 Compare January 7, 2025 12:56
src/utils/files.ts Show resolved Hide resolved
{
[DateLevel.Year]: date.getUTCFullYear().toString(),
[DateLevel.Month]: ("0" + (date.getUTCMonth() + 1)).slice(-2),
[DateLevel.Day]: ("0" + date.getUTCDate()).slice(-2),
Copy link
Member

Choose a reason for hiding this comment

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

We have a function called padWithLeadingZeros in the src/modules/migrations/add.ts module that does exactly this. It would be nice to reuse it.

@IvanKiral IvanKiral force-pushed the fix_webhooks_headers branch from 7dafee8 to 7a7a2c2 Compare January 7, 2025 16:08
it("should pad the number with leading zeros when numberOfZeros is greater than the length of the number", () => {
expect(padWithLeadingZeros(5, 3)).toBe("005");
expect(padWithLeadingZeros(42, 5)).toBe("00042");
expect(padWithLeadingZeros(0, 4)).toBe("0000");
Copy link
Member

Choose a reason for hiding this comment

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

Prefer parametrized tests over one test with multiple expects each for a different case.

["2025-02-07-15-08", DateLevel.Minute],
["2025-02-07-15-08-40", DateLevel.Second],
])(
"correctly serializes datetime",
Copy link
Member

Choose a reason for hiding this comment

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

Include the case data in the test-case name so the cases are distinguishable. Now it is not possible to know which case failed. You can use there printf formatting. https://vitest.dev/api/#test-each

@IvanKiral IvanKiral force-pushed the fix_webhooks_headers branch from 7a7a2c2 to e6a0f8e Compare January 7, 2025 16:41
@IvanKiral IvanKiral force-pushed the fix_webhooks_headers branch from e6a0f8e to 4ec949c Compare January 7, 2025 16:47
Copy link
Member

@JiriLojda JiriLojda left a comment

Choose a reason for hiding this comment

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

Lets go

@IvanKiral IvanKiral merged commit fd09508 into main Jan 8, 2025
3 checks passed
@IvanKiral IvanKiral deleted the fix_webhooks_headers branch January 8, 2025 09:18
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