Files
TicketLab_MCP/src/hello.test.ts
T
andreferraroandCursor d0d5d9a7a6
sonar / sonar (push) Skipped
sonar / sonar (pull_request) Failing after 1m8s
fix: bound OTEL shutdown so CI tests do not hang
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-11 15:11:31 -03:00

29 lines
759 B
TypeScript

import assert from "node:assert/strict";
import { describe, it } from "node:test";
import { greet, main } from "./hello.js";
describe("greet", () => {
it("returns the default greeting", () => {
assert.equal(greet(), "Hello, TicketLab MCP!");
});
it("returns a greeting for a custom name", () => {
assert.equal(greet("World"), "Hello, World!");
});
});
it("main emits telemetry and logs greeting", async () => {
process.env.OTEL_EXPORTER_OTLP_ENDPOINT = "http://127.0.0.1:9";
const logs: unknown[] = [];
const original = console.log;
console.log = (...args: unknown[]) => {
logs.push(args);
};
try {
await main();
assert.deepEqual(logs, [["Hello, TicketLab MCP!"]]);
} finally {
console.log = original;
}
});