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

Update sync examples with check to async check #1448

Merged
merged 22 commits into from
Sep 30, 2024

Conversation

inancgumus
Copy link
Member

What?

Updates sync examples with check to async check.

Some of the examples don't require an async check, but it's better to use async check in them for consistency.

Why?

The sync k6 check is cumbersome when working with async functions.

Checklist

  • I have performed a self-review of my code
  • I have added tests for my changes
  • I have commented on my code, particularly in hard-to-understand areas

Related PR(s)/Issue(s)

grafana/k6-docs#1725

@inancgumus inancgumus added documentation Improvements or additions to documentation ci labels Sep 27, 2024
@inancgumus inancgumus self-assigned this Sep 27, 2024
Copy link
Collaborator

@ankur22 ankur22 left a comment

Choose a reason for hiding this comment

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

Thanks for working on this change.

My personal preference would be to avoid then chaining as i think it looks complicated to a new user who is new to JS.

I'd also only try to retrieve data to compare within a check rather than do any changes to the DOM or elsewhere in the website/system. I like to think that a check is almost like an assert, and generally we only compare two things in an assert, rather than perform state changes to the system within the assert.

Since these are both style issue though, happy to approve and get them merged in 👍

examples/dispatch.js Outdated Show resolved Hide resolved
examples/elementstate.js Outdated Show resolved Hide resolved
examples/evaluate.js Outdated Show resolved Hide resolved
Copy link

@allansson allansson left a comment

Choose a reason for hiding this comment

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

Thanks for doing this. 🙏

I left a few comments.

examples/cookies.js Show resolved Hide resolved
examples/dispatch.js Outdated Show resolved Hide resolved
examples/cookies.js Show resolved Hide resolved
Copy link
Collaborator

@ankur22 ankur22 left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM 🚀

@inancgumus inancgumus merged commit cc34feb into main Sep 30, 2024
23 checks passed
@inancgumus inancgumus deleted the update/examples-to-async-check branch September 30, 2024 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants