fix(typescript): dynamically calculate expected hasNextPage in pagination tests #11149
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Refs: Slack thread from @tstanmay13
Fixes the TypeScript SDK's wire test generator to dynamically calculate the expected
hasNextPage()value based on pagination type and example data, instead of hardcodingtrue.Link to Devin run: https://app.devin.ai/sessions/6353b685386f4bfd821c4daa4196ef35
Requested by: [email protected] (@tstanmay13)
Changes Made
getPropertyValueFromJson()for response propertiesgetRequestPropertyValueFromJson()for request propertiescalculateExpectedHasNextPage()function that mirrors the SDK's actual pagination logic:truewhennextproperty is non-null and non-empty stringtruewhenresults.length >= step, or falls back toresults.length > 0when step value can't be extracted (e.g., GET requests with query params)truelistWithCursorPaginationendpoint in pagination test definition to verifyhasNextPage: falsecaseTesting
pnpm run check)hasNextPage().toBe(false)for the new "Last page" exampleHuman Review Checklist
calculateExpectedHasNextPage()matches the SDK's actual implementationresultsLength > 0when step value can't be extracted is acceptable (this happens for GET requests where limit/step is a query param, not in the request body)originalNameforNametypes andwireValueforNameAndWireValuetypesCI Notes
Two CI failures are unrelated to this PR:
java-model: TypeScript errors inRustFilenameRegistry.ts(Rust generator)test:SourceFetcher.test.tserrors in browser-compatible-base