Files
accounted/lib/bokslut/arsredovisning/__tests__/capabilities.test.ts
T
Mattsson e11f70b347 Bug/gh issues fiz (#1103)
* refactor: optimize page loading and data fetching

* fix: resolve recurring production runtime errors

* feat: add MCP company and customer updates

* fix: handle year-end tax adjustments

* feat: harden annual report compliance

* fix: expand invoice logo and font support

* fix: sanitize API route error responses

* fix: sanitize user-facing error messages

* feat: persist onboarding and tax assessment notices

* fix: reduce cloud backup audit churn

* feat: refine invoice editor layout

* fix: show saved tax adjustments in INK2

* fix: complete annual report API mappings

* docs: record operational safeguards and decisions

* fix: harden annual report review findings

* fix: adjust column span for description based on VAT registration

* New css class name
2026-07-21 23:00:15 +02:00

41 lines
1.4 KiB
TypeScript

import { afterEach, describe, expect, it, vi } from 'vitest'
import { getAnnualReportCapabilities } from '../capabilities'
afterEach(() => vi.unstubAllEnvs())
describe('getAnnualReportCapabilities', () => {
it('keeps direct filing closed unless the release gate is explicit', () => {
vi.stubEnv('NEXT_PUBLIC_BOLAGSVERKET_FILING_ENABLED', '')
const result = getAnnualReportCapabilities('k2', {
k2_eligible: true,
digital_filing_eligible: true,
digital_issues: [],
size_classification: 'smaller',
k2_relief_rule: 'eligible',
issues: [],
})
expect(result.paper.enabled).toBe(true)
expect(result.ixbrl_preview.enabled).toBe(true)
expect(result.connected_filing.enabled).toBe(false)
})
it('opens connected filing only when release and eligibility gates pass', () => {
vi.stubEnv('NEXT_PUBLIC_BOLAGSVERKET_FILING_ENABLED', 'true')
const result = getAnnualReportCapabilities('k2', {
k2_eligible: true,
digital_filing_eligible: true,
digital_issues: [],
size_classification: 'smaller',
k2_relief_rule: 'eligible',
issues: [],
})
expect(result.connected_filing.enabled).toBe(true)
})
it('does not present the current K3 draft as paper-filing ready', () => {
const result = getAnnualReportCapabilities('k3')
expect(result.paper.enabled).toBe(false)
expect(result.paper.reason).toMatch(/granskningsutkast/i)
})
})