fix(cloud): ENTERPRISE-AUDIT lint gates: fixture data filename, no cast in the category filter, fixed clock in the pane test

This commit is contained in:
Neil
2026-11-12 20:52:30 -08:00
parent c8e56c2e26
commit a99ae6d512
5 changed files with 14 additions and 6 deletions
@@ -3,7 +3,7 @@
// Enterprise audit log now, so this pane must never call an audit route (the control plane
// refuses those without the entitlement) and must never show an error because of one.
import { cleanup, render, screen, waitFor } from '@testing-library/react'
import { afterEach, expect, it, vi } from 'vitest'
import { afterEach, beforeEach, expect, it, vi } from 'vitest'
import type {
CloudApiKeyList,
CloudApiMe,
@@ -12,12 +12,18 @@ import type {
import { TooltipProvider } from '@/components/ui/tooltip'
import { CloudApiKeysPane } from './CloudApiKeysPane'
beforeEach(() => {
vi.useFakeTimers({ now: NOW, toFake: ['Date'] })
})
afterEach(() => {
cleanup()
vi.useRealTimers()
vi.unstubAllGlobals()
})
const NOW = Date.now()
// A fixed clock, so "5 minutes ago" never depends on when the test runs.
const NOW = Date.UTC(2026, 10, 12, 17, 30)
const ME: CloudApiMe = {
accountId: 'org:acme',
userId: 'u_ada',
@@ -158,8 +158,10 @@ function Filters({
value={filters.category ?? ALL}
disabled={disabled}
onValueChange={(value) =>
// SAFETY: every option's value is ALL or a member of CLOUD_AUDIT_CATEGORIES.
onFilter({ ...filters, category: value === ALL ? null : (value as CloudAuditCategory) })
onFilter({
...filters,
category: CLOUD_AUDIT_CATEGORIES.find((category) => category === value) ?? null
})
}
>
<SelectTrigger
@@ -1,7 +1,7 @@
import { defineFixture } from '../../../component-fixtures/component-fixture'
import { SettingsSection } from '../section-layout/SettingsSection'
import { EnterpriseSettingsView } from './EnterpriseSettingsView'
import { fixtureAuditProps } from './enterprise-fixture-data'
import { fixtureAuditProps } from './enterprise-audit.fixtures'
import type { EnterpriseAuditLogProps } from './EnterpriseAuditLog'
const BARE_BODY = 'rounded-none border-0 bg-transparent p-0 shadow-none'
@@ -6,7 +6,7 @@ import {
EnterpriseSettingsView as RawView,
type EnterpriseSettingsViewProps
} from './EnterpriseSettingsView'
import { FIXTURE_EVENTS, FIXTURE_NOW, fixtureAuditProps } from './enterprise-fixture-data'
import { FIXTURE_EVENTS, FIXTURE_NOW, fixtureAuditProps } from './enterprise-audit.fixtures'
import { auditCategoryLabel, auditEventSentence, isKnownAuditAction } from './enterprise-audit-copy'
afterEach(cleanup)