Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
next: result => {
count++;
if (count === 1) {
expect(result.data).toBeUndefined();
expect(result.loading).toBe(true);
}
if (count === 2) {
expect(result.loading).toBe(false);
expect(stripSymbols(result.data)).toEqual(initialData);
expect(stripSymbols(observable.getCurrentResult().data)).toEqual(
initialData,
);
// step 2, recycle it
observable.setOptions({
fetchPolicy: 'standby',
pollInterval: 0,
fetchResults: false,
});
observableQueries.push({
observableQuery: observable,
subscription: observable.subscribe({}),
});
result => {
expect(stripSymbols(result)).toEqual({
data: data1,
loading: false,
networkStatus: NetworkStatus.ready,
stale: false,
});
},
result => {
next: wrap(done, newResult => {
const expectedResult = assign(
{ fromRx: true, loading: false, networkStatus: 7, stale: false },
expResult,
);
expect(stripSymbols(newResult)).toEqual(expectedResult);
done();
}),
});
next: result => {
try {
expect(stripSymbols(result.data)).toEqual(data1);
expect(stripSymbols(result.data)).toEqual(
stripSymbols(observable.currentResult().data),
);
done();
} catch (error) {
done.fail(error);
}
},
error: error => done.fail(error),
subscribeAndCount(done, obs, (handleCount, result) => {
const resultData = stripSymbols(result.data);
if (handleCount === 1) {
expect(resultData).toEqual(initialData);
} else if (handleCount === 2) {
expect(resultData).toEqual(networkFetch);
done();
}
});
});
const store = defaultNormalizedCacheFactory({
ROOT_QUERY: {
id: 'abcd',
nullField: null,
'numberField({"floatArg":3.14,"intArg":0})': 5,
'stringField({"arg":"This is a default string!"})': 'Heyo',
},
});
const result = reader.readQueryFromStore({
store,
query,
variables,
});
expect(stripSymbols(result)).toEqual({
id: 'abcd',
nullField: null,
numberField: 5,
stringField: 'Heyo',
});
});
data: dataOne,
loading: false,
networkStatus: 7,
stale: false,
});
queryManager.mutate({
mutation,
optimisticResponse,
updateQueries,
});
} else if (count === 2) {
expect(stripSymbols(result.data.people_one)).toEqual(
optimisticResponse,
);
} else if (count === 3) {
expect(stripSymbols(result.data.people_one)).toEqual(mutationData);
done();
}
});
});
subscribeAndCount(done, observable, () => {
expect(stripSymbols(observable.getCurrentResult())).toEqual({
data: dataOne,
loading: false,
networkStatus: 7,
partial: false,
});
done();
});
const withDefault = client.query({ query }).then(actualResult => {
return expect(stripSymbols(actualResult.data)).toEqual(result);
});
next: result => {
count++;
if (count === 1) {
expect(stripSymbols(result.data)).toEqual(initialData);
setTimeout(() => {
link.simulateResult({ result: { data: laterData } });
}, 10);
}
if (count === 2) {
expect(stripSymbols(result.data)).toEqual(laterData);
done();
}
},
error: e => {