本文整理匯總了TypeScript中test/TestHelper.descriptorResource函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript descriptorResource函數的具體用法?TypeScript descriptorResource怎麽用?TypeScript descriptorResource使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了descriptorResource函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: 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);
fragmentCache.update(descriptorResource({
path: '/resource-array'
}), dataSegmentResource_Array, IStatus.complete);
fragmentCache.update(descriptorResource({
path: '/resource-object'
}), dataSegmentResource_Object, IStatus.complete);
fragmentCache.update(descriptorResource({
path: '/resource-string'
}), dataSegmentResource_String, IStatus.complete);
});
示例2: it
it('should mark existing cache data as stale', () => {
fragmentCache.update(descriptorResource({
path: '/other-resource'
}), null);
expectedQueries['/other-resource'] = {
timestamp: ITimestamp.stale,
status: IStatus.complete,
data: dataSegmentFull_Resource
};
expect(fragmentCache).to.have.property('fragments')
.that.deep.equals(expectedFragments);
expect(fragmentCache).to.have.property('queries')
.that.deep.equals(expectedQueries);
});
示例3: it
it('should add new cache data', () => {
fragmentCache.update(descriptorResource({
path: '/resource',
partial: MinimalPartial
}), dataSegmentFull_Resource);
expectedQueries['/resource'] = {
timestamp: mockTimestamp,
status: IStatus.complete,
data: dataSegmentFull_Resource
};
expect(fragmentCache).to.have.property('fragments')
.that.deep.equals(expectedFragments);
expect(fragmentCache).to.have.property('queries')
.that.deep.equals(expectedQueries);
});
示例4: 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(descriptorResource({
path: '/other-resource'
}), dataSegmentFull_Resource, IStatus.complete);
expectedFragments = JSON.parse(JSON.stringify(fragmentCache.fragments));
expectedQueries = JSON.parse(JSON.stringify(fragmentCache.queries));
});