describe('#update', () => { it('should update a group by id', () => { api.patch(`${GROUPS_URL_V2}${MANAGER_GROUP.id}/`).reply(200, ADMIN_GROUP) return expect(groups.update(MANAGER_GROUP.id, ADMIN_GROUP)).resolves.toMatchSnapshot() }) })
queue.push(function () { nock('https://rest.messagebird.com') .patch('/contacts/contact-id', '{"firstName":"new-name"}') .reply(200, {}); var params = { firstName: 'new-name' }; messagebird.contacts.update('contact-id', params, function (err, data) { doTest(err, 'contacts.update', []); }); });
mockCheckUpdateCall (options = {}) { const response = options.response ? options.response : checkUpdateResponse const checkRunId = options.checkRunId ? options.checkRunId : '4' const path = `/repos/${this.repo.owner.login}/${this.repo.name}/check-runs/${checkRunId}` return nock('https://api.github.com') .patch(path, (body) => { options.requestBody = body return true }) .reply(200, response) }
.query({query, page_size: 1, limit: 1}) .reply(200, {objects: [{name: 'John Doe', id: 3}], next: null}) .patch(`/v2/instances/${instanceName}/classes/users/objects/3/`) .query({query, page_size: 1, limit: 1}) .reply(200, user)
break; case 'patch': scope.patch(/.*/).reply(404); break; default:
.matchHeader('content-type', 'application/json-patch+json') .matchHeader('abc', 'XYZ') .patch('/Patient/152747', JSONPatch) .reply(200, () => readStreamFor('patient-patched.json')); const response = await this.fhirClient.patch({ resourceType: 'Patient', id: '152747', .matchHeader('accept', 'application/json+fhir') .matchHeader('content-type', 'application/json-patch+json') .patch('/Patient/152747', JSONPatch) .reply(200, () => readStreamFor('patient-patched.json')); const response = await this.fhirClient.patch({ resourceType: 'Patient', id: '152747', .matchHeader('accept', 'application/json+fhir') .matchHeader('content-type', 'application/json-patch+json') .patch('/Patient/152747', invalidPatch) .reply(500, () => readStreamFor('patient-not-patched.json')); response = await this.fhirClient.patch({ resourceType: 'Patient', id: '152747',
queue.push(function () { var params = { 'status': 'disabled' }; nock('https://conversations.messagebird.com') .patch('/v1/webhooks/webhook-id', params) .reply(200, { id: 'webhook-id', url: 'https://example.com/webhook', channelId: 'channel-id', events: [ 'message.created', 'message.updated' ], status: 'disabled' }); messagebird.conversations.webhooks.update('webhook-id', params, function (err, data) { doTest(err, 'conversations.webhooks.update', [ ['type', data instanceof Object], ['.id', data && data.id === 'webhook-id'], ['.channelId', data && data.channelId === 'channel-id'], ['.status', data && data.status === 'disabled'] ]); }); });
.patch(`/v2/instances/${instanceName}/classes/posts/objects/10/`) .query({ page_size: 500
queue.push(function () { var params = { status: 'archived' }; nock('https://conversations.messagebird.com') .patch('/v1/conversations/conversation-id', params) .reply(200, { id: 'conversation-id', contactId: 'contact-id', status: 'archived' }); messagebird.conversations.update('conversation-id', params, function (err, data) { doTest(err, 'conversations.update', [ ['type', data instanceof Object], ['.id', data && data.id === 'conversation-id'], ['.status', data && data.status === 'archived'], ['.contactId', data && data.contactId === 'contact-id'] ]); }); });
queue.push(function () { nock('https://rest.messagebird.com') .patch('/groups/group-id', '{"name":"new-name"}') .reply(200, { id: 'group-id', href: 'https://rest.messagebird.com/groups/group-id', name: 'new-name', contacts: { totalCount: 3, href: 'https://rest.messagebird.com/groups/group-id' }, createdDatetime: '2018-07-25T12:16:10+00:00', updatedDatetime: '2018-07-25T12:16:23+00:00' } ); messagebird.groups.update('group-id', 'new-name', function (err, data) { doTest(err, 'groups.update', [ ['.id', data.id === 'group-id'] ]); }); });