Skip to content

Commit dbf301c

Browse files
committed
Fix prettier issues
1 parent 4a66f70 commit dbf301c

File tree

2 files changed

+28
-31
lines changed

2 files changed

+28
-31
lines changed

packages/mst-query/tests/models/ListQuery.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ export const ListQuery = createInfiniteQuery('ListQuery', {
1111
},
1212
onQueryMore({ data, query }) {
1313
query.data?.addItems(data?.items);
14-
}
15-
});
14+
},
15+
});

packages/mst-query/tests/mstQuery.test.tsx

+26-29
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ test('gc - only walk model props', () => {
7575
id: types.identifier,
7676
modelProp: types.string,
7777
arr: types.late(() =>
78-
types.array(types.model({ id: types.identifier, b: types.maybe(types.string) }))
78+
types.array(types.model({ id: types.identifier, b: types.maybe(types.string) })),
7979
),
8080
})
8181
.volatile(() => ({
@@ -84,7 +84,7 @@ test('gc - only walk model props', () => {
8484
const idents = new Set();
8585
collectSeenIdentifiers(
8686
ModelA.create({ id: '1', modelProp: 'hey', arr: [{ id: '3' }] }),
87-
idents
87+
idents,
8888
);
8989
expect(idents.size).toBe(2);
9090
});
@@ -121,7 +121,7 @@ test('useQuery', async () => {
121121
() => q.itemQuery.isLoading,
122122
(isLoading) => {
123123
loadingStates.push(isLoading);
124-
}
124+
},
125125
);
126126

127127
const Comp = observer(() => {
@@ -149,7 +149,7 @@ test('useMutation', async () => {
149149
() => q.addItemMutation.isLoading,
150150
(isLoading) => {
151151
loadingStates.push(isLoading);
152-
}
152+
},
153153
);
154154

155155
const Comp = observer(() => {
@@ -238,7 +238,7 @@ test('onQueryMore', async () => {
238238
let isFetchingMoreStates: boolean[] = [false];
239239
reaction(
240240
() => q.listQuery.isFetchingMore,
241-
(isFetchingMore) => isFetchingMoreStates.push(isFetchingMore)
241+
(isFetchingMore) => isFetchingMoreStates.push(isFetchingMore),
242242
);
243243

244244
let offset = observable.box(0);
@@ -373,7 +373,7 @@ test('merge of date objects', () => {
373373
},
374374
},
375375
DateModel,
376-
queryClient.config.env
376+
queryClient.config.env,
377377
);
378378
const result = merge(
379379
{
@@ -383,7 +383,7 @@ test('merge of date objects', () => {
383383
},
384384
},
385385
DateModel,
386-
queryClient.config.env
386+
queryClient.config.env,
387387
);
388388
expect((getSnapshot(result) as any).changed.at).toBe(1583193600000);
389389

@@ -402,13 +402,13 @@ test('deep update of object', () => {
402402
const result = merge(
403403
{ model: { a: 'banana' }, ref: { id: '1', a: 'fruit' } },
404404
DeepModelA,
405-
queryClient.config.env
405+
queryClient.config.env,
406406
);
407407
applySnapshot(a, result);
408408
const result2 = merge(
409409
{ model: { a: 'banana', b: 'apple' }, ref: { id: '1', a: 'orange' } },
410410
DeepModelA,
411-
queryClient.config.env
411+
queryClient.config.env,
412412
);
413413

414414
applySnapshot(a, result2);
@@ -432,7 +432,7 @@ test('merge frozen type', () => {
432432
rootStore.serviceStore.frozenQuery.__MstQueryHandler.setData({
433433
id: 'test',
434434
frozen: { data1: 'data1', data2: 'data2' },
435-
})
435+
}),
436436
).not.toThrow();
437437
});
438438

@@ -458,7 +458,7 @@ test('merge with undefined data and union type', () => {
458458
id: 'test',
459459
folderPath: 'test',
460460
origin: undefined,
461-
})
461+
}),
462462
).not.toThrow();
463463
});
464464

@@ -469,13 +469,13 @@ test('findAll', () => {
469469

470470
const queries = queryClient.queryStore.getQueries(
471471
ItemQuery,
472-
(query) => !!query.variables.request?.id.includes('t')
472+
(query) => !!query.variables.request?.id.includes('t'),
473473
);
474474
expect(queries.length).toBe(1);
475475

476476
const queries2 = queryClient.queryStore.getQueries(
477477
ItemQuery,
478-
(query) => !!query.variables.request?.id.includes('o')
478+
(query) => !!query.variables.request?.id.includes('o'),
479479
);
480480
expect(queries2.length).toBe(0);
481481
});
@@ -656,7 +656,7 @@ test('support map type', () => {
656656
});
657657

658658
expect(rootStore.serviceStore.frozenQuery.data?.amountLimit?.content?.get('native')?.tag).toBe(
659-
'Limited'
659+
'Limited',
660660
);
661661
});
662662

@@ -670,7 +670,7 @@ test('merge with partial data', () => {
670670
optionalProps1: 'optional',
671671
optionalProps2: ['optional'],
672672
optionalProps3: { a: 'a' },
673-
})
673+
}),
674674
).not.toThrow();
675675
expect(rootStore.serviceStore.frozenQuery.data?.id).toBe('test');
676676
expect(rootStore.serviceStore.frozenQuery.data?.origin).toBe('a');
@@ -860,15 +860,15 @@ test('useQuery should not run when initialData is passed and staleTime is larger
860860
() => q.itemQuery.isLoading,
861861
(isLoading) => {
862862
loadingStates.push(isLoading);
863-
}
863+
},
864864
);
865865

866866
let dataStates: any[] = [];
867867
const dataReaction = reaction(
868868
() => q.itemQuery.data,
869869
(data: any) => {
870870
dataStates.push(data ? data.id : null);
871-
}
871+
},
872872
);
873873

874874
const Comp = observer(() => {
@@ -884,7 +884,7 @@ test('useQuery should not run when initialData is passed and staleTime is larger
884884
await wait(0);
885885

886886
expect(loadingStates).toEqual([]);
887-
expect(dataStates).toEqual(["test"]);
887+
expect(dataStates).toEqual(['test']);
888888
expect(q.itemQuery.data?.id).toBe('test');
889889

890890
id.set('different-test');
@@ -893,15 +893,14 @@ test('useQuery should not run when initialData is passed and staleTime is larger
893893
expect(q.itemQuery.data?.id).toBe('test');
894894
expect(q.itemQuery.variables.request?.id).toBe('different-test');
895895
expect(loadingStates).toEqual([]);
896-
expect(dataStates).toEqual(["test"]);
897-
896+
expect(dataStates).toEqual(['test']);
897+
898898
isLoadingReaction();
899899
dataReaction();
900900

901901
configureMobx({ enforceActions: 'observed' });
902902
});
903903

904-
905904
test('useQuery should run when initialData is passed and initialDataUpdatedAt is older than staleTime', async () => {
906905
const { render, q } = setup();
907906

@@ -969,7 +968,7 @@ test('useQuery should run when initialData is given and invalidate is called', a
969968
expect(loadingStates).toEqual([false, true, false]);
970969

971970
disposer();
972-
configureMobx({ enforceActions: 'observed' });
971+
configureMobx({ enforceActions: 'observed' });
973972
});
974973

975974
test('refetchOnMount & refetchOnRequestChanged', async () => {
@@ -1094,14 +1093,14 @@ test('render null when request changes', async () => {
10941093

10951094
configureMobx({ enforceActions: 'never' });
10961095

1097-
let id = observable.box('test');
1096+
let id = observable.box('test');
10981097

10991098
let dataStates: any[] = [];
11001099
const sub = reaction(
11011100
() => q.itemQuery.data,
11021101
(data: any) => {
11031102
dataStates.push(data);
1104-
}
1103+
},
11051104
);
11061105

11071106
const Comp = observer(() => {
@@ -1113,16 +1112,14 @@ test('render null when request changes', async () => {
11131112

11141113
render(<Comp />);
11151114
await wait(0);
1116-
1117-
expect(dataStates.length).toBe(1);;
1115+
1116+
expect(dataStates.length).toBe(1);
11181117

11191118
id.set('different-test');
11201119
await wait(0);
1121-
1120+
11221121
expect(dataStates[1]).toBe(null);
11231122
expect(dataStates[2].id).toBe('different-test');
11241123

11251124
configureMobx({ enforceActions: 'observed' });
11261125
});
1127-
1128-
// TODO: Pass in onQueryMore and endpoint directly to useQuery, does this even work?

0 commit comments

Comments
 (0)