本文整理汇总了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));
});
示例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);
});
示例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);
});
示例4: Store
const fixtureStore = (): void => {
refStore = new Store();
refStore.updateResource(descriptorCollection({
basePath: '/projects'
}), [dataSegmentId_1, dataSegmentId_2], IStatus.complete);
};
示例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);
});
示例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'));
};
示例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);
});
示例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);
});