History

Use Schema JSON encoding in trace diagnostics tests

Cursor Agent committed 4 months ago

Commit ec4f0891 parent e2b13e11 file · +5 −2Browse files

Unified · Split

apps/server/src/diagnostics/TraceDiagnostics.test.ts+5−2
@@ -7,9 +7,12 @@ import * as Logger from "effect/Logger"; · 6 unmodified lines
77 import * as Option from "effect/Option";
88 import * as PlatformError from "effect/PlatformError";
99 import * as References from "effect/References";
10+import * as Schema from "effect/Schema";
1011
1112 import * as TraceDiagnostics from "./TraceDiagnostics.ts";
1213
14+const encodeUnknownJsonString = Schema.encodeUnknownSync(Schema.UnknownFromJsonString);
15+
1316 function ns(ms: number): string {
1417 return String(BigInt(ms) * 1_000_000n);
1518 }
@@ -23,7 +26,7 @@ function record(input: { · 7 unmodified lines
2326 readonly exit?: { readonly _tag: "Success" | "Failure" | "Interrupted"; readonly cause?: string };
2427 readonly events?: ReadonlyArray<unknown>;
2528 }) {
26− return JSON.stringify({
29+ return encodeUnknownJsonString({
2730 type: "effect-span",
2831 name: input.name,
2932 traceId: input.traceId,
@@ -159,7 +162,7 @@ describe("TraceDiagnostics", () => { · 129 unmodified lines
159162 files: [
160163 {
161164 path: "/tmp/server.trace.ndjson",
162− text: JSON.stringify({
165+ text: encodeUnknownJsonString({
163166 name: "server.noStart",
164167 traceId: "trace-no-start",
165168 spanId: "span-no-start",

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t