style: apply Biome formatting to enterprise files

This commit is contained in:
SnapOtter
2026-06-14 14:53:44 +08:00
parent 954cfb01a6
commit e7bef34918
23 changed files with 166 additions and 228 deletions
+6 -2
View File
@@ -1,5 +1,9 @@
import { describe, it, expect } from "vitest";
import { canonicalize, computeHmac, verifyHmac } from "../../../apps/api/src/lib/audit-integrity.js";
import { describe, expect, it } from "vitest";
import {
canonicalize,
computeHmac,
verifyHmac,
} from "../../../apps/api/src/lib/audit-integrity.js";
describe("audit integrity", () => {
const testKey = Buffer.from("a".repeat(64), "hex");
+3 -3
View File
@@ -1,9 +1,9 @@
import { describe, it, expect } from "vitest";
import { describe, expect, it } from "vitest";
import {
encrypt,
decrypt,
isEncrypted,
deriveAuditHmacKey,
encrypt,
isEncrypted,
} from "../../../apps/api/src/lib/encryption.js";
describe("encryption", () => {
+1 -1
View File
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
import { ENTERPRISE_FEATURES, PLAN_FEATURES } from "@snapotter/enterprise";
import { describe, expect, it } from "vitest";
describe("enterprise feature flags", () => {
it("includes all Phase 1 flags", () => {
+5 -13
View File
@@ -1,4 +1,4 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
import { beforeEach, describe, expect, it, vi } from "vitest";
describe("enterprise mock", () => {
beforeEach(() => {
@@ -6,9 +6,7 @@ describe("enterprise mock", () => {
});
it("mocks feature enabled", async () => {
const { mockEnterpriseFeatures } = await import(
"../../helpers/enterprise-mock.js"
);
const { mockEnterpriseFeatures } = await import("../../helpers/enterprise-mock.js");
mockEnterpriseFeatures(["audit_export", "siem_forwarding"]);
const { isFeatureEnabled } = await import("@snapotter/enterprise");
expect(isFeatureEnabled("audit_export")).toBe(true);
@@ -17,18 +15,14 @@ describe("enterprise mock", () => {
});
it("mocks no enterprise", async () => {
const { mockNoEnterprise } = await import(
"../../helpers/enterprise-mock.js"
);
const { mockNoEnterprise } = await import("../../helpers/enterprise-mock.js");
mockNoEnterprise();
const { isFeatureEnabled } = await import("@snapotter/enterprise");
expect(isFeatureEnabled("audit_export")).toBe(false);
});
it("returns license payload with correct shape", async () => {
const { mockEnterpriseFeatures } = await import(
"../../helpers/enterprise-mock.js"
);
const { mockEnterpriseFeatures } = await import("../../helpers/enterprise-mock.js");
mockEnterpriseFeatures(["s3_storage", "mfa"]);
const { getActiveLicense } = await import("@snapotter/enterprise");
const license = getActiveLicense();
@@ -41,9 +35,7 @@ describe("enterprise mock", () => {
});
it("returns null license when no enterprise", async () => {
const { mockNoEnterprise } = await import(
"../../helpers/enterprise-mock.js"
);
const { mockNoEnterprise } = await import("../../helpers/enterprise-mock.js");
mockNoEnterprise();
const { getActiveLicense } = await import("@snapotter/enterprise");
expect(getActiveLicense()).toBeNull();
+4 -6
View File
@@ -1,4 +1,4 @@
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
describe("webhook delivery", () => {
beforeEach(() => {
@@ -15,11 +15,9 @@ describe("webhook delivery", () => {
vi.stubGlobal("fetch", fetchMock);
const { deliverWebhook } = await import("../../../apps/api/src/lib/webhook-delivery.js");
const result = await deliverWebhook(
"https://siem.example.com/input",
"Bearer test-token",
[{ event: "LOGIN_SUCCESS", timestamp: "2026-01-01T00:00:00Z" }],
);
const result = await deliverWebhook("https://siem.example.com/input", "Bearer test-token", [
{ event: "LOGIN_SUCCESS", timestamp: "2026-01-01T00:00:00Z" },
]);
expect(result.success).toBe(true);
expect(result.attempts).toBe(1);