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

Shop test #111

Merged
merged 20 commits into from
Feb 20, 2024
Merged

Shop test #111

merged 20 commits into from
Feb 20, 2024

Conversation

chuck-dbos
Copy link
Collaborator

No description provided.

@chuck-dbos chuck-dbos marked this pull request as ready for review February 20, 2024 17:47
): Promise<void> {
): Promise<void>
{
if (webhook === "http://fakehost/webhook") {
Copy link
Member

Choose a reason for hiding this comment

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

In the operations.test.ts, can we try to use spyOn for the fetch call?

Copy link
Member

Choose a reason for hiding this comment

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

Like this:

const fetchMock = jest
  .spyOn(global, 'fetch')
  .mockImplementation(() =>
    Promise.resolve({ json: () => Promise.resolve([]) })
  )

(https://stackoverflow.com/a/73597163)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was going to illustrate both ways. I think it is fair to have some provision for behaviors that occur only in test mode, as mocks can get very complicated and almost as hard to debug as the real code.

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense

@chuck-dbos chuck-dbos requested a review from qianl15 February 20, 2024 19:43
@qianl15 qianl15 merged commit 5480eee into main Feb 20, 2024
6 checks passed
@qianl15 qianl15 deleted the chuck/shoptest branch February 20, 2024 23:43
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