Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
cacheTimeKeyFor,
queueKeyFor,
} from '../stores/shared.js';
import { QueryResult } from 'src/types.js';
import { QueryResult } from '../types.js';
import { DiscriminatedReactivePromise } from 'signalium';

/**
Expand Down
6 changes: 4 additions & 2 deletions packages/fetchium/src/__tests__/mutations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ describe('Mutations', () => {
mockFetch.delete('/items/[id]', { ok: true });

class DeleteItem extends RESTMutation {
readonly params = { id: t.id };
readonly path = `/items/${this.params.id}`;
readonly method = 'DELETE' as const;
readonly params = { id: t.id };
readonly result = { ok: t.boolean };
}

Expand All @@ -175,7 +175,9 @@ describe('Mutations', () => {

expect(mut.isResolved).toBe(true);
expect(mockFetch.calls[0].options.body).toBeUndefined();
expect(mockFetch.calls[0].options.headers?.['Content-Type']).toBeUndefined();
expect(
(mockFetch.calls[0].options.headers as Record<string, string> | undefined)?.['Content-Type'],
).toBeUndefined();
});
});

Expand Down
2 changes: 2 additions & 0 deletions packages/fetchium/src/__tests__/rest-query-api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ describe('REST Query API', () => {

describe('Response Type Handling', () => {
it.skip('should handle primitive response types', async () => {
const { client, mockFetch } = getClient();
mockFetch.get('/message', 'Hello, World!');

class GetMessage extends RESTQuery {
Expand All @@ -285,6 +286,7 @@ describe('REST Query API', () => {
});

it.skip('should handle array responses', async () => {
const { client, mockFetch } = getClient();
mockFetch.get('/numbers', [1, 2, 3, 4, 5]);

class GetNumbers extends RESTQuery {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ describe('React AsyncQueryStore Integration', () => {
);

// Both should eventually show data
await expect.element(getByTestId('user-2')).toBeInTheDocument();
await expect.element(getByTestId('user-1')).toBeInTheDocument();
await expect.element(getByTestId('post-100')).toBeInTheDocument();

expect(getByTestId('user-1').element().textContent).toBe('Alice');
Expand Down
2 changes: 1 addition & 1 deletion packages/fetchium/src/react/__tests__/component.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { RESTQuery } from '../../rest/index.js';
import { fetchQuery } from '../../query.js';
import { createMockFetch, sleep } from '../../__tests__/utils.js';
import { createRenderCounter } from './utils.js';
import { QueryPromise } from 'src/types.js';
import { QueryPromise } from '../../types.js';
import { RESTQueryController } from '../../rest/RESTQueryController.js';

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/fetchium/src/react/__tests__/use-query.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { fetchQuery } from '../../query.js';
import { createMockFetch, sleep } from '../../__tests__/utils.js';
import { createRenderCounter } from './utils.js';
import { useQuery } from '../use-query.js';
import { QueryPromise } from 'src/types.js';
import { QueryPromise } from '../../types.js';
import { RESTQueryController } from '../../rest/RESTQueryController.js';

/**
Expand Down
Loading