本文整理汇总了TypeScript中test/TestHelper.descriptorCollectionItem函数的典型用法代码示例。如果您正苦于以下问题:TypeScript descriptorCollectionItem函数的具体用法?TypeScript descriptorCollectionItem怎么用?TypeScript descriptorCollectionItem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了descriptorCollectionItem函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
});
示例3: it
it('should mark existing cache data as stale', () => {
fragmentCache.update(descriptorCollectionItem({
path: '/projects/3',
id: 3,
partial: MinimalPartial,
cacheStrategy: IStrategy.merge,
collectionStrategy: IStrategy.merge
}), null);
expectedFragments[MinimalPartial]['3'] = {
timestamp: ITimestamp.stale,
status: IStatus.complete,
data: dataSegmentPartial__ID_3
};
expectedQueries['/projects/3'] = {
timestamp: ITimestamp.stale,
status: IStatus.complete,
data: '3'
};
expect(fragmentCache).to.have.property('fragments')
.that.deep.equals(expectedFragments);
expect(fragmentCache).to.have.property('queries')
.that.deep.equals(expectedQueries);
});
示例4: it
it('should return expected result', () => {
const descriptor = descriptorCollectionItem({
id: '1'
});
const result = fragmentCache.fetch(descriptor);
expectResultWithContent(result, dataSegmentFull__ID_1);
});
示例5: beforeEach
beforeEach(() => {
fragmentCache = new FragmentCache();
fragmentCache.update(descriptorCollection({
path: '/other-projects',
partial: MinimalPartial
}), [dataSegmentPartial__ID_3, dataSegmentPartial__ID_4], IStatus.complete);
fragmentCache.update(descriptorCollectionItem({
path: '/projects/3'
}), dataSegmentFull__ID_3, IStatus.complete);
fragmentCache.update(descriptorCollectionItem({
path: '/projects/4'
}), dataSegmentFull__ID_4, IStatus.complete);
fragmentCache.update(descriptorFrom({
path: '/other-resource'
}), dataSegmentFull_Resource, IStatus.complete);
expectedFragments = JSON.parse(JSON.stringify(fragmentCache.fragments));
expectedQueries = JSON.parse(JSON.stringify(fragmentCache.queries));
});
示例6: it
it('should update cache', () => {
fragmentCache.destroy(descriptorCollectionItem({
path: '/projects/1'
}));
expectedQueries['/projects/1'] = undefined;
expect(fragmentCache).to.have.property('fragments')
.that.deep.equals(expectedFragments);
expect(fragmentCache).to.have.property('queries')
.that.deep.equals(expectedQueries);
});
示例7: it
it('should update cache', () => {
fragmentCache.touch(descriptorCollectionItem({
id: '11'
}), {
timestamp: 1234
});
expectedFragments[DefaultPartial]['11'] = { timestamp: 1234 };
expect(fragmentCache).to.have.property('fragments')
.that.deep.equals(expectedFragments);
expect(fragmentCache).to.have.property('queries')
.that.deep.equals(expectedQueries);
});