test(ui): consolidate SDK test helpers - #6931
Merged
Merged
Conversation
Centralizes API type factories in a single file so `mockTag`, `mockNamespace`, and future factories land alongside `mockUserAuth`.
…Response`
`sdkError.ts` duplicated `makeSdkError` from `sdk.ts` without the
`SdkHttpError` type or header support. Delete it and point all
consumers at `makeSdkError`.
`SdkResponse` now includes `error: undefined` to match the actual
hey-api client shape (`{ data, error, request, response }`).
|
Claude finished @luizhf42's task in 58s —— View job Code Review CompleteReviewed 15 files across code quality, security, testing, language patterns, and architecture — no new issues found. The code looks good as-is. A few notes on why the change is sound:
If you push additional changes and want a new review, tag |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Consolidated duplicated SDK test factories into canonical locations and aligned
SdkResponsewith the actual hey-api client shape.Why
Prerequisite cleanup for shellhub-io/team#216 (Task 5 — migrating page/component tests to mock
@/client). Reduces the number of ad-hoc error factories tests need to know about before the migration touches every test file.Changes
factories.ts: renamed fromuserAuth.tsto host all API type factory functions (mockUserAuthtoday,mockTag/mockNamespacenext); updated 3 consumers (Login.test.tsx,authStore.test.ts,mfaResetStore.test.ts)sdkError.tsdeleted: duplicatedmakeSdkErrorfromsdk.tswithout theSdkHttpErrortype or header support; 8 page tests migrated tomakeSdkErrorSdkResponse: addederror: undefinedto match the hey-apiRequestResultdiscriminated union ({ data, error, request, response })makeSdkError: return type widened toError & SdkHttpErrorso it satisfies bothSdkHttpErrorand React Query'sError | nullerror field on hook mocks (temporary — theErrorside becomes irrelevant once page tests stop mocking hooks)