本文整理匯總了TypeScript中test/TestSupport.mock_put函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript mock_put函數的具體用法?TypeScript mock_put怎麽用?TypeScript mock_put使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了mock_put函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should correctly update entries', () => {
mock_put('/rules', dataRules);
return invokeTestHelper(IActionType.update, schema.rules.__stack, {
payload: dataRules,
expectedSignal: dataRules
});
});
示例2: beforeEach
beforeEach(() => {
mutableUsers = new MutableResource(schema.users);
store = expectedDescriptor.store = schema.__node.definition.storeMap.getOrCreate('user');
spyMutableUsers_generateDescriptor = spy(mutableUsers, '_generateDescriptor');
spyStore_touchResource = spy(store, 'touchResource');
spyStore_updateResource = spy(store, 'updateResource');
spyStore_destroyResource = spy(store, 'destroyResource');
mock_reset();
mock_put('/users', responseData);
});
示例3: expect
.then(() => {
expect(resourceUsers).to.deep.match({
data: dataCollectionUsers1,
status: IStatus.complete,
timestamp: (val: number) => val > ITimestamp.loading
});
mock_put('/users/1', { id: 1, name: 'bob foo' });
const promiseUpdate = mutableUser.update({ name: 'bob foo' });
// The `touch` event from our `update` does not affect the collection
expect(resourceUsers).to.deep.match({
data: dataCollectionUsers1,
status: IStatus.complete,
timestamp: (val: number) => val > ITimestamp.loading
});
return promiseUpdate;
})