test: enrich coverage for queryKeys, BaseQueryStore, and BatchFontStore
- queryKeys: add mutation-safety test for batch(), key hierarchy tests (list/batch/detail keys rooted in their parent base keys), and unique-key test for different detail IDs - BaseQueryStore: add initial-state test (data undefined, isError false before any fetch resolves) - BatchFontStore: add FontResponseError type assertion on malformed response, null error assertion on success, and setIds([]) disables query and returns empty fonts without triggering a fetch
This commit is contained in:
@@ -51,6 +51,12 @@ describe('BaseQueryStore', () => {
|
||||
await vi.waitFor(() => expect(store.data).toBe('ok'), { timeout: 1000 });
|
||||
expect(store.isLoading).toBe(false);
|
||||
});
|
||||
|
||||
it('should have undefined data and no error in initial loading state', () => {
|
||||
const store = new TestStore(['initial-state'], () => new Promise(r => setTimeout(() => r('late'), 500)));
|
||||
expect(store.data).toBeUndefined();
|
||||
expect(store.isError).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Error Handling', () => {
|
||||
|
||||
Reference in New Issue
Block a user