This commit is contained in:
parent
175ebbc343
commit
f4caf6aecc
|
@ -12,6 +12,7 @@ describe('useStateQueryStore', () => {
|
||||||
const { add, isLoading, remove, reset } = useStateQueryStore();
|
const { add, isLoading, remove, reset } = useStateQueryStore();
|
||||||
const firstQuery = { url: 'myQuery' };
|
const firstQuery = { url: 'myQuery' };
|
||||||
const secondQuery = { url: 'myQuery' };
|
const secondQuery = { url: 'myQuery' };
|
||||||
|
const thirdQuery = { url: 'myQuery' };
|
||||||
|
|
||||||
function getQueries() {
|
function getQueries() {
|
||||||
return stateQueryStore.queries;
|
return stateQueryStore.queries;
|
||||||
|
@ -41,16 +42,16 @@ describe('useStateQueryStore', () => {
|
||||||
expect(isLoading().value).toBeFalsy();
|
expect(isLoading().value).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should add and remove hash', async () => {
|
it('should add and remove query', async () => {
|
||||||
add(firstQuery);
|
add(firstQuery);
|
||||||
add(secondQuery);
|
add(secondQuery);
|
||||||
|
|
||||||
const beforeCount = getQueries().size;
|
const beforeCount = getQueries().size;
|
||||||
const hash = add();
|
add(thirdQuery);
|
||||||
expect(getQueries().has(hash)).toBeTruthy();
|
expect(getQueries().has(thirdQuery)).toBeTruthy();
|
||||||
|
|
||||||
remove(hash);
|
remove(thirdQuery);
|
||||||
expect(getQueries().has(hash)).toBeFalsy();
|
expect(getQueries().has(thirdQuery)).toBeFalsy();
|
||||||
expect(getQueries().size).toBe(beforeCount);
|
expect(getQueries().size).toBe(beforeCount);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue