mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-01 10:53:35 +00:00
27 lines
793 B
TypeScript
27 lines
793 B
TypeScript
// Verifies plugin startup trace segment sanitization.
|
|
import { describe, expect, it } from "vitest";
|
|
import { encodeStartupTraceSegment } from "./startup-trace-segment.js";
|
|
|
|
describe("encodeStartupTraceSegment", () => {
|
|
it("keeps distinct trace owner ids non-colliding", () => {
|
|
const encoded = [
|
|
encodeStartupTraceSegment("plugin:test"),
|
|
encodeStartupTraceSegment("plugin_test"),
|
|
encodeStartupTraceSegment("service/a"),
|
|
encodeStartupTraceSegment("service_a"),
|
|
encodeStartupTraceSegment(""),
|
|
encodeStartupTraceSegment("~"),
|
|
];
|
|
|
|
expect(encoded).toEqual([
|
|
"plugin~003Atest",
|
|
"plugin_test",
|
|
"service~002Fa",
|
|
"service_a",
|
|
"~",
|
|
"~007E",
|
|
]);
|
|
expect(new Set(encoded).size).toBe(encoded.length);
|
|
});
|
|
});
|