Skip to content

Conversation

ankur22
Copy link
Contributor

@ankur22 ankur22 commented Aug 13, 2025

What?

This PR contains cleanups/refactors based on comments made on previous PRs when working on the page.getBy* APIs.

Why?

Here are the list of comments:

Checklist

  • I have performed a self-review of my code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests for my changes.
  • I have run linter and tests locally (make check) and all pass.

Checklist: Documentation (only for k6 maintainers and if relevant)

Please do not merge this PR until the following items are filled out.

  • I have added the correct milestone and labels to the PR.
  • I have updated the release notes: link
  • I have updated or added an issue to the k6-documentation: grafana/k6-docs#NUMBER if applicable
  • I have updated or added an issue to the TypeScript definitions: grafana/k6-DefinitelyTyped#NUMBER if applicable

Related PR(s)/Issue(s)

#5049 (comment)
#4933
#4956
#4964

This was already supported, just missed the test for it.
- Use string concatenation
- Use const for empty string
- Trim spaces.
- Return early if len of s is 1 or less.
There is no point in continuing the test if the precondition fails.
@ankur22 ankur22 added this to the v1.3.0 milestone Aug 18, 2025
@ankur22 ankur22 marked this pull request as ready for review August 18, 2025 16:30
@ankur22 ankur22 requested a review from a team as a code owner August 18, 2025 16:30
@ankur22 ankur22 requested review from codebien and oleiade and removed request for a team August 18, 2025 16:30
@ankur22 ankur22 merged commit 01dd94a into master Aug 22, 2025
43 of 44 checks passed
@ankur22 ankur22 deleted the refactor/getBy branch August 22, 2025 14:15
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.

3 participants