本文整理匯總了TypeScript中apollo-utilities.stripSymbols函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript stripSymbols函數的具體用法?TypeScript stripSymbols怎麽用?TypeScript stripSymbols使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了stripSymbols函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: setTimeout
setTimeout(() => {
const cacheResult = stripSymbols(cache.read({ query }));
expect(cacheResult).toEqual(initialData);
expect(cacheResult).toEqual(stripSymbols(result.data));
if (count === 1) {
done();
}
}, 10);
示例2: expect
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();
}
},
示例3: it
it('will read some data from the store', () => {
const proxy = createCache({
initialState: {
apollo: {
data: {
ROOT_QUERY: {
a: 1,
b: 2,
c: 3,
},
},
},
},
});
expect(
stripSymbols(
proxy.readQuery({
query: gql`
{
a
}
`,
}),
),
).toEqual({ a: 1 });
expect(
stripSymbols(
proxy.readQuery({
query: gql`
{
b
c
}
`,
}),
),
).toEqual({ b: 2, c: 3 });
expect(
stripSymbols(
proxy.readQuery({
query: gql`
{
a
b
c
}
`,
}),
),
).toEqual({ a: 1, b: 2, c: 3 });
});
示例4: it
it('runs a basic query', () => {
const result = {
id: 'abcd',
stringField: 'This is a string!',
numberField: 5,
nullField: null,
} as StoreObject;
const store = defaultNormalizedCacheFactory({
ROOT_QUERY: result,
});
const queryResult = reader.readQueryFromStore({
store,
query: gql`
query {
stringField
numberField
}
`,
});
// The result of the query shouldn't contain __data_id fields
expect(stripSymbols(queryResult)).toEqual({
stringField: result['stringField'],
numberField: result['numberField'],
});
});