-
Notifications
You must be signed in to change notification settings - Fork 1
Fix TypeScript error in useQueryBuilder test #31
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,16 @@ | |
| */ | ||
| import { renderHook, act } from "@testing-library/react-native"; | ||
|
|
||
| /* ---- Types ---- */ | ||
| interface SerializedFilter { | ||
| logic: string; | ||
| filters: Array<{ | ||
| field: string; | ||
| operator: string; | ||
| value: string; | ||
| }>; | ||
| } | ||
|
|
||
| /* ---- Mock query-builder helpers ---- */ | ||
| let mockNextId = 0; | ||
| jest.mock("~/lib/query-builder", () => ({ | ||
|
|
@@ -186,7 +196,7 @@ describe("useQueryBuilder", () => { | |
|
|
||
| const serialized = result.current.serialize(); | ||
| expect(serialized).toBeDefined(); | ||
| expect(serialized.logic).toBe("AND"); | ||
| expect((serialized as SerializedFilter).logic).toBe("AND"); | ||
|
Comment on lines
197
to
+199
|
||
| }); | ||
|
|
||
| it("manages selected fields and projection", () => { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new
SerializedFilterinterface suggests the real ObjectQL serialization format is an object withlogic/filters, but the productionserializeFilterTree()returns an array-based AST (unknown | null). To avoid confusion, consider renaming this to something test/mock-specific (e.g.,MockSerializedFilter) or switching the expectation to structural matching without introducing a misleading type name.