當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript apollo-utilities.stripSymbols函數代碼示例

本文整理匯總了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);
開發者ID:apollostack,項目名稱:apollo-client,代碼行數:8,代碼來源:links.ts

示例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();
   }
 },
開發者ID:apollostack,項目名稱:apollo-client,代碼行數:13,代碼來源:live.ts

示例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 });
 });
開發者ID:petermichuncc,項目名稱:scanner,代碼行數:51,代碼來源:cache.ts

示例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'],
    });
  });
開發者ID:apollostack,項目名稱:apollo-client,代碼行數:28,代碼來源:readFromStore.ts


注:本文中的apollo-utilities.stripSymbols函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。