Skip to content

Commit db70859

Browse files
committed
fix(console): type the routed reads as unknown and the test doubles strictly (objectui#12032)
Claude-Session: https://claude.ai/code/session_01CGZy1BGCjdN5cXqL9cnvB8 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 6ccacb8 commit db70859

3 files changed

Lines changed: 3 additions & 5 deletions

File tree

‎apps/console/src/services/approvalRequestsDataSource.recordPage.test.tsx‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
* These pins mount the page over the routed source with only the HTTP
1414
* transport doubled, so each answer reaches the page as the door hands it.
1515
*/
16-
import * as React from 'react';
1716
import { describe, it, expect, vi, afterEach } from 'vitest';
1817
import { render, screen, cleanup, waitFor } from '@testing-library/react';
1918
import { MemoryRouter } from 'react-router-dom';
@@ -86,7 +85,7 @@ vi.stubGlobal('fetch', vi.fn(async () => json(200, { success: true, data: [] }))
8685

8786
/** The console's adapter, doubled: the page's side reads land here. */
8887
const host = {
89-
find: vi.fn(async () => ({ data: [], total: 0 })),
88+
find: vi.fn(async (_resource: string, _params?: unknown) => ({ data: [], total: 0 })),
9089
findOne: vi.fn(async () => null),
9190
create: vi.fn(), update: vi.fn(), delete: vi.fn(),
9291
getObjectSchema: vi.fn(async () => objectDef),

‎apps/console/src/services/approvalRequestsDataSource.test.tsx‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
* `ListView` is the REAL component over the REAL door: what it sends is what a
1919
* list view on this source sends.
2020
*/
21-
import * as React from 'react';
2221
import { describe, it, expect, vi, beforeEach } from 'vitest';
2322
import { render, waitFor, screen } from '@testing-library/react';
2423
import { SchemaRendererProvider } from '@object-ui/react';

‎apps/console/src/services/approvalRequestsDataSource.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export function createApprovalRequestsDataSource(
162162
const scopeParams = toScopeParams(scope);
163163
const itemDoor = new ApiDataSource<ApprovalRequestRow>({ read: { url, method: 'GET' }, fetch: fetchFn });
164164

165-
const find = async (resource: string, params?: QueryParams): Promise<QueryResult<any>> => {
165+
const find = async (resource: string, params?: QueryParams): Promise<QueryResult<unknown>> => {
166166
if (resource !== APPROVAL_REQUEST_OBJECT) return host.find(resource, params);
167167
const query = toListQuery(params);
168168
if (scopeParams === null) return { data: [], total: 0 };
@@ -173,7 +173,7 @@ export function createApprovalRequestsDataSource(
173173
return listDoor.find(resource);
174174
};
175175

176-
const findOne = async (resource: string, id: string, params?: QueryParams): Promise<any> => {
176+
const findOne = async (resource: string, id: string, params?: QueryParams): Promise<unknown> => {
177177
if (resource !== APPROVAL_REQUEST_OBJECT) return host.findOne(resource, id, params);
178178
return itemDoor.findOne(resource, encodeURIComponent(id));
179179
};

0 commit comments

Comments
 (0)