Skip to main content
Glama
patch.test.ts919 B
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 import type { Operation } from 'rfc6902'; import { patchObject } from './patch'; describe('Patch utils', () => { test('Add success', () => { const input = { foo: 'bar' }; const patch: Operation[] = [{ op: 'add', path: '/baz', value: 'qux' }]; patchObject(input, patch); expect(input).toEqual({ foo: 'bar', baz: 'qux' }); }); test('Malformed patch', () => { const input = { foo: 'bar' }; const patch = [{ op: 'invalid' }] as unknown as Operation[]; expect(() => patchObject(input, patch)).toThrow('Invalid operation: invalid'); }); test('Test failure', () => { const input = { foo: 'bar' }; const patch: Operation[] = [{ op: 'test', path: '/x', value: 'x' }]; expect(() => patchObject(input, patch)).toThrow('Test failed: undefined != x'); }); });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/medplum/medplum'

If you have feedback or need assistance with the MCP directory API, please join our Discord server