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

docs(examples): add example for spy functions #1222

Merged
merged 3 commits into from
Dec 2, 2024

Conversation

adairo
Copy link
Contributor

@adairo adairo commented Nov 30, 2024

Hello deno community!
I added an example for how to spy on functions using std@testing/mock

Related to issue #1088

I wasn't sure in which group put this example so I kinda created a new group for 'Testing'. I want to upload another example on how to use stubs. It seems like the group should be created elsewhere in order to appear as a correct group (titlecase), I would really appreciate little help on this :)

Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

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

LGTM

(Maybe we can also add more advanced examples where spied functions are called indirectly via some other functions. But this one seems just fine for giving the basic idea of spying)

* @tags cli, deploy
* @run <url>
* @resource {https://jsr.io/@std/testing/doc/mock#spying} Spy docs on JSR
* @resource {https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html} Typescript docs for `using` keyword
Copy link
Member

Choose a reason for hiding this comment

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

Good reference 👍

@kt3k kt3k merged commit fc816f4 into denoland:main Dec 2, 2024
2 checks passed
@adairo
Copy link
Contributor Author

adairo commented Dec 2, 2024

Thank you very much @kt3k for taking the time to review this. For sure I'll consider adding more advanced examples.

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