import { describe, it, expect } from "vitest";
import { nodeVitestConfig } from "./vitest.base.node";

describe("nodeVitestConfig", () => {
  it("uses node environment", () => {
    expect(nodeVitestConfig.test?.environment).toBe("node");
  });
  it("enables clearMocks, restoreMocks, mockReset", () => {
    expect(nodeVitestConfig.test?.clearMocks).toBe(true);
    expect(nodeVitestConfig.test?.restoreMocks).toBe(true);
    expect(nodeVitestConfig.test?.mockReset).toBe(true);
  });
  it("declares coverage thresholds", () => {
    expect(nodeVitestConfig.test?.coverage?.thresholds).toMatchObject({
      statements: 80, branches: 75, functions: 80, lines: 80,
    });
  });
  it("includes src and tests glob", () => {
    expect(nodeVitestConfig.test?.include).toEqual(
      expect.arrayContaining(["src/**/*.test.ts", "tests/**/*.test.ts"]),
    );
  });
  it("excludes factories and contracts from coverage", () => {
    expect(nodeVitestConfig.test?.coverage?.exclude).toEqual(
      expect.arrayContaining(["src/__factories__/**", "src/__contracts__/**"]),
    );
  });
});
