MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / evaluate

Function evaluate

packages/plugins/mcp/src/sdk/codex-repl.test.ts:14–19  ·  view source on GitHub ↗
(expression: string)

Source from the content-addressed store, hash-verified

12 * expression is `JSON.parse(<js string literal>)`, so unwrap the literal and
13 * parse it the same way the REPL would. */
14const evaluate = (expression: string): unknown => {
15 expect(expression.startsWith("JSON.parse(")).toBe(true);
16 const literal = expression.slice("JSON.parse(".length, -1);
17 // oxlint-disable-next-line executor/no-json-parse -- the subject under test IS the JSON embedding; decoding it exactly as the REPL would is the assertion, and a schema decode would hide the prototype behaviour being checked
18 return JSON.parse(JSON.parse(literal) as string);
19};
20
21describe("jsLiteral", () => {
22 it("keeps a prototype-named key as an own key", () => {

Callers 3

codex-repl.test.tsFile · 0.70
tryOrElseFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected