Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

config.test.ts

18 lines740 Bytes

1import * as OtelEnvironment from "@t3tools/shared/otelEnvironment";
2import { assert, describe, it } from "@effect/vitest";
3​
4import * as ServerConfig from "./config.ts";
5​
6describe("otlpResource", () => {
7 const resource = (resourceAttributes: Record<string, string>) =>
8 ServerConfig.otlpResource(
9 { mode: "web", otelEnvironment: { ...OtelEnvironment.none, resourceAttributes } },
10 "box-1",
11 );
12​
13 it("names the host, unless OTEL_RESOURCE_ATTRIBUTES already does", () => {
14 assert.equal(resource({}).attributes["host.name"], "box-1");
15 assert.equal(resource({ "host.name": "from-env" }).attributes["host.name"], "from-env");
16 assert.equal(resource({ "host.name": "" }).attributes["host.name"], "box-1");
17 });
18});