All checks were successful
CI/CD / go-lint (push) Has been skipped
CI/CD / python-lint (push) Has been skipped
CI/CD / nodejs-lint (push) Has been skipped
CI/CD / test-go-ai-compliance (push) Successful in 47s
CI/CD / test-python-backend-compliance (push) Successful in 36s
CI/CD / test-python-document-crawler (push) Successful in 24s
CI/CD / test-python-dsms-gateway (push) Successful in 20s
CI/CD / validate-canonical-controls (push) Successful in 11s
CI/CD / Deploy (push) Successful in 2s
- Extract ControlForm, ControlDetail, GeneratorModal, helpers into separate component files (max ~470 lines each, was 1210) - Add Collection selector in Generator modal - Add Job History view in Generator modal - Add Review Queue button with counter badge - Add review mode navigation (prev/next through review items) - Add vitest tests for helpers (getDomain, constants, options) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
57 lines
1.9 KiB
TypeScript
57 lines
1.9 KiB
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import { getDomain, BACKEND_URL, EMPTY_CONTROL, DOMAIN_OPTIONS, COLLECTION_OPTIONS } from '../components/helpers'
|
|
|
|
describe('getDomain', () => {
|
|
it('extracts domain from control_id', () => {
|
|
expect(getDomain('AUTH-001')).toBe('AUTH')
|
|
expect(getDomain('NET-042')).toBe('NET')
|
|
expect(getDomain('CRYPT-003')).toBe('CRYPT')
|
|
})
|
|
|
|
it('returns empty string for invalid control_id', () => {
|
|
expect(getDomain('')).toBe('')
|
|
expect(getDomain('NODASH')).toBe('NODASH')
|
|
})
|
|
})
|
|
|
|
describe('BACKEND_URL', () => {
|
|
it('points to canonical API proxy', () => {
|
|
expect(BACKEND_URL).toBe('/api/sdk/v1/canonical')
|
|
})
|
|
})
|
|
|
|
describe('EMPTY_CONTROL', () => {
|
|
it('has required fields with default values', () => {
|
|
expect(EMPTY_CONTROL.framework_id).toBe('bp_security_v1')
|
|
expect(EMPTY_CONTROL.severity).toBe('medium')
|
|
expect(EMPTY_CONTROL.release_state).toBe('draft')
|
|
expect(EMPTY_CONTROL.tags).toEqual([])
|
|
expect(EMPTY_CONTROL.requirements).toEqual([''])
|
|
expect(EMPTY_CONTROL.test_procedure).toEqual([''])
|
|
expect(EMPTY_CONTROL.evidence).toEqual([{ type: '', description: '' }])
|
|
expect(EMPTY_CONTROL.open_anchors).toEqual([{ framework: '', ref: '', url: '' }])
|
|
})
|
|
})
|
|
|
|
describe('DOMAIN_OPTIONS', () => {
|
|
it('contains expected domains', () => {
|
|
const values = DOMAIN_OPTIONS.map(d => d.value)
|
|
expect(values).toContain('AUTH')
|
|
expect(values).toContain('NET')
|
|
expect(values).toContain('CRYPT')
|
|
expect(values).toContain('AI')
|
|
expect(values).toContain('COMP')
|
|
expect(values.length).toBe(10)
|
|
})
|
|
})
|
|
|
|
describe('COLLECTION_OPTIONS', () => {
|
|
it('contains expected collections', () => {
|
|
const values = COLLECTION_OPTIONS.map(c => c.value)
|
|
expect(values).toContain('bp_compliance_ce')
|
|
expect(values).toContain('bp_compliance_gesetze')
|
|
expect(values).toContain('bp_compliance_datenschutz')
|
|
expect(values.length).toBe(6)
|
|
})
|
|
})
|