import { describe, it, expect } from "vitest";
import { RecordingTracer, RecordingLogger } from "@repo/core-testing/instrumentation";
import { Mock{{pascalCase entity}}Repository } from "@/infrastructure/repositories/{{kebabCase entity}}.repository.mock";

// Mock repo also wraps in spans.
describe("Mock{{pascalCase entity}}Repository emits spans", () => {
  it("get{{pascalCase entity}} emits one span with op='repository'", async () => {
    const tracer = new RecordingTracer();
    const logger = new RecordingLogger();
    const repo = new Mock{{pascalCase entity}}Repository(undefined, tracer, logger);
    await repo.get{{pascalCase entity}}("seed-1");
    expect(tracer.spans).toHaveLength(1);
    expect(tracer.spans[0]).toMatchObject({
      name: "{{camelCase entity}}.get{{pascalCase entity}}",
      op: "repository",
    });
    expect(typeof tracer.spans[0]!.attributes.found).toBe("boolean");
  });
});
