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


TypeScript TestHelper.descriptorCollection函數代碼示例

本文整理匯總了TypeScript中test/TestHelper.descriptorCollection函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript descriptorCollection函數的具體用法?TypeScript descriptorCollection怎麽用?TypeScript descriptorCollection使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了descriptorCollection函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: beforeEach

    beforeEach(() => {
      fragmentCache = new FragmentCache();

      fragmentCache.update(descriptorCollection({
        path: '/projects',
        partial: MinimalPartial
      }), [dataSegmentPartial__ID_1, dataSegmentPartial__ID_2], IStatus.complete);
      fragmentCache.update(descriptorCollection({
        path: '/projects?filter=123',
        partial: MinimalPartial
      }), [dataSegmentPartial__ID_1, dataSegmentPartial__ID_3], IStatus.complete);

      fragmentCache.update(descriptorCollectionItem({
        path: '/projects/1'
      }), dataSegmentFull__ID_1, IStatus.complete);
      fragmentCache.update(descriptorCollectionItem({
        path: '/projects/2'
      }), dataSegmentFull__ID_2, IStatus.complete);
      fragmentCache.update(descriptorCollectionItem({
        path: '/projects/3'
      }), dataSegmentFull__ID_3, IStatus.complete);

      expectedFragments = JSON.parse(JSON.stringify(fragmentCache.fragments));
      expectedQueries = JSON.parse(JSON.stringify(fragmentCache.queries));
    });
開發者ID:netarc,項目名稱:refrax,代碼行數:25,代碼來源:fragmentCache-invalidate.specp.ts

示例2: it

            it('should add new cache data', () => {
              fragmentCache.update(descriptorCollection({
                path: '/projects'
              }), [dataSegmentPartial__ID_1, dataSegmentPartial__ID_2]);

              expectedFragments[DefaultPartial]['1'] = {
                timestamp: mockTimestamp,
                status: IStatus.complete,
                data: dataSegmentPartial__ID_1
              };
              expectedFragments[DefaultPartial]['2'] = {
                timestamp: mockTimestamp,
                status: IStatus.complete,
                data: dataSegmentPartial__ID_2
              };
              expectedQueries['/projects'] = {
                timestamp: mockTimestamp,
                status: IStatus.complete,
                data: ['1', '2']
              };

              expect(fragmentCache).to.have.property('fragments')
                .that.deep.equals(expectedFragments);
              expect(fragmentCache).to.have.property('queries')
                .that.deep.equals(expectedQueries);
            });
開發者ID:netarc,項目名稱:refrax,代碼行數:26,代碼來源:fragmentCache-updateReplace.specp.ts

示例3: it

            it('should update existing cache data', () => {
              fragmentCache.update(descriptorCollection({
                path: '/other-projects',
                partial: MinimalPartial,
                cacheStrategy: IStrategy.merge,
                collectionStrategy: IStrategy.merge
              }), [dataSegmentPartial__ID_1, dataSegmentPartial__ID_2]);

              expectedFragments[MinimalPartial]['1'] = {
                timestamp: mockTimestamp,
                status: IStatus.complete,
                data: dataSegmentPartial__ID_1
              };
              expectedFragments[MinimalPartial]['2'] = {
                timestamp: mockTimestamp,
                status: IStatus.complete,
                data: dataSegmentPartial__ID_2
              };
              expectedQueries['/other-projects'] = {
                timestamp: mockTimestamp,
                status: IStatus.complete,
                data: ['3', '4', '1', '2']
              };

              expect(fragmentCache).to.have.property('fragments')
                .that.deep.equals(expectedFragments);
              expect(fragmentCache).to.have.property('queries')
                .that.deep.equals(expectedQueries);
            });
開發者ID:netarc,項目名稱:refrax,代碼行數:29,代碼來源:fragmentCache-updateMerge.specp.ts

示例4: Store

const fixtureStore = (): void => {
  refStore = new Store();

  refStore.updateResource(descriptorCollection({
    basePath: '/projects'
  }), [dataSegmentId_1, dataSegmentId_2], IStatus.complete);
};
開發者ID:netarc,項目名稱:refrax,代碼行數:7,代碼來源:store.spec.ts

示例5: it

        it('should return default result for non-existing path', () => {
          const descriptor = descriptorCollection({
            path: '/projectz',
            partial: 'minimal'
          });
          const result = fragmentCache.fetch(descriptor);

          expectResultDefault(result);
        });
開發者ID:netarc,項目名稱:refrax,代碼行數:9,代碼來源:fragmentCache-fetch.specp.ts

示例6: StoreMap

const fixtureStoreMap = (): void => {
  refStoreMap = new StoreMap();
  refStoreMap
    .add(new Store('project'))
    .updateResource(descriptorCollection({
      basePath: '/projects'
    }), [dataSegmentId_1, dataSegmentId_2], IStatus.complete);
  refStoreMap.add(new Store('user'));
  refStoreMap.add(new Store('account'));
};
開發者ID:netarc,項目名稱:refrax,代碼行數:10,代碼來源:storeMap.spec.ts

示例7: it

        it('should update cache', () => {
          fragmentCache.destroy(descriptorCollection({
            path: '/projects'
          }));

          expectedQueries['/projects'] = undefined;

          expect(fragmentCache).to.have.property('fragments')
            .that.deep.equals(expectedFragments);
          expect(fragmentCache).to.have.property('queries')
            .that.deep.equals(expectedQueries);
        });
開發者ID:netarc,項目名稱:refrax,代碼行數:12,代碼來源:fragmentCache-destroy.specp.ts

示例8: beforeEach

    beforeEach(() => {
      fragmentCache = new FragmentCache();

      fragmentCache.update(descriptorCollection({
        path: '/projects',
        partial: 'minimal'
      }), [dataSegmentPartial__ID_1, dataSegmentPartial__ID_2], IStatus.complete);
      fragmentCache.update(descriptorCollectionItem({
        path: '/projects/1'
      }), dataSegmentFull__ID_1, IStatus.complete);
      fragmentCache.update(descriptorCollectionItem({
        path: '/projects/2'
      }), dataSegmentFull__ID_2, IStatus.complete);
    });
開發者ID:netarc,項目名稱:refrax,代碼行數:14,代碼來源:fragmentCache-destroy.specp.ts


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