test: add tests for compliance advisor IFRS prompt and ingestion script
All checks were successful
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Successful in 33s
CI / test-python-backend-compliance (push) Successful in 26s
CI / test-python-document-crawler (push) Successful in 23s
CI / test-python-dsms-gateway (push) Successful in 18s
All checks were successful
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Successful in 33s
CI / test-python-backend-compliance (push) Successful in 26s
CI / test-python-document-crawler (push) Successful in 23s
CI / test-python-dsms-gateway (push) Successful in 18s
46 tests covering: - COMPLIANCE_COLLECTIONS validation - IFRS endorsement warning content (5 points, CELEX, EFRAG reference) - Ingestion script structure (download_pdf, upload_file functions) - IFRS/EFRAG/ENISA URLs and metadata validation - Chunking config and verification phase Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
|
||||
/**
|
||||
* Tests for Compliance Advisor system prompt:
|
||||
* - COMPLIANCE_COLLECTIONS includes required collections
|
||||
* - IFRS endorsement warning is present
|
||||
* - EU-IFRS competence area is declared
|
||||
*/
|
||||
|
||||
// Replicate COMPLIANCE_COLLECTIONS from route.ts
|
||||
const COMPLIANCE_COLLECTIONS = [
|
||||
'bp_compliance_gesetze',
|
||||
'bp_compliance_ce',
|
||||
'bp_compliance_datenschutz',
|
||||
'bp_dsfa_corpus',
|
||||
'bp_compliance_recht',
|
||||
'bp_legal_templates',
|
||||
] as const
|
||||
|
||||
// Replicate the IFRS system prompt sections
|
||||
const IFRS_COMPETENCE = [
|
||||
'EU-IFRS (Verordnung 2023/1803)',
|
||||
'EFRAG Endorsement Status',
|
||||
]
|
||||
|
||||
const IFRS_ENDORSEMENT_WARNING = `Bei ALLEN Fragen zu IFRS/IAS-Standards MUSST du folgende Punkte beachten:
|
||||
1. Dein Wissen basiert auf den **EU-uebernommenen IFRS** (Verordnung 2023/1803, Stand Okt 2023).
|
||||
2. Die IASB/IFRS Foundation gibt regelmaessig neue oder geaenderte Standards heraus, die von der EU noch NICHT uebernommen sein koennten.
|
||||
3. Weise den Nutzer IMMER darauf hin: "Dieser Hinweis basiert auf den EU-endorsed IFRS (Stand: Verordnung 2023/1803). Pruefen Sie den aktuellen EFRAG Endorsement Status fuer neuere Standards."
|
||||
4. Bei internationalen Ausschreibungen: Nur EU-endorsed IFRS sind fuer EU-Unternehmen rechtsverbindlich.
|
||||
5. Verweise NICHT auf IFRS Foundation Originaltexte, sondern ausschliesslich auf die EU-Verordnung.`
|
||||
|
||||
describe('Compliance Advisor System Prompt', () => {
|
||||
describe('COMPLIANCE_COLLECTIONS', () => {
|
||||
it('should include bp_compliance_ce for IFRS/CE documents', () => {
|
||||
expect(COMPLIANCE_COLLECTIONS).toContain('bp_compliance_ce')
|
||||
})
|
||||
|
||||
it('should include bp_compliance_datenschutz for EFRAG/ENISA', () => {
|
||||
expect(COMPLIANCE_COLLECTIONS).toContain('bp_compliance_datenschutz')
|
||||
})
|
||||
|
||||
it('should include bp_compliance_gesetze for laws', () => {
|
||||
expect(COMPLIANCE_COLLECTIONS).toContain('bp_compliance_gesetze')
|
||||
})
|
||||
|
||||
it('should include bp_dsfa_corpus for DSFA', () => {
|
||||
expect(COMPLIANCE_COLLECTIONS).toContain('bp_dsfa_corpus')
|
||||
})
|
||||
|
||||
it('should have exactly 6 collections', () => {
|
||||
expect(COMPLIANCE_COLLECTIONS).toHaveLength(6)
|
||||
})
|
||||
})
|
||||
|
||||
describe('IFRS Competence Area', () => {
|
||||
it('should declare EU-IFRS Verordnung 2023/1803', () => {
|
||||
expect(IFRS_COMPETENCE[0]).toContain('2023/1803')
|
||||
})
|
||||
|
||||
it('should declare EFRAG Endorsement Status', () => {
|
||||
expect(IFRS_COMPETENCE[1]).toContain('EFRAG')
|
||||
})
|
||||
})
|
||||
|
||||
describe('IFRS Endorsement Warning', () => {
|
||||
it('should mention Verordnung 2023/1803', () => {
|
||||
expect(IFRS_ENDORSEMENT_WARNING).toContain('Verordnung 2023/1803')
|
||||
})
|
||||
|
||||
it('should warn about IASB/IFRS Foundation updates', () => {
|
||||
expect(IFRS_ENDORSEMENT_WARNING).toContain('IASB/IFRS Foundation')
|
||||
})
|
||||
|
||||
it('should instruct to reference EFRAG status', () => {
|
||||
expect(IFRS_ENDORSEMENT_WARNING).toContain('EFRAG Endorsement Status')
|
||||
})
|
||||
|
||||
it('should mention EU-endorsed IFRS only', () => {
|
||||
expect(IFRS_ENDORSEMENT_WARNING).toContain('EU-endorsed IFRS')
|
||||
})
|
||||
|
||||
it('should warn against IFRS Foundation original texts', () => {
|
||||
expect(IFRS_ENDORSEMENT_WARNING).toContain('NICHT auf IFRS Foundation Originaltexte')
|
||||
})
|
||||
|
||||
it('should mention international tenders requirement', () => {
|
||||
expect(IFRS_ENDORSEMENT_WARNING).toContain('internationalen Ausschreibungen')
|
||||
})
|
||||
|
||||
it('should have 5 numbered points', () => {
|
||||
const points = IFRS_ENDORSEMENT_WARNING.match(/^\d+\./gm)
|
||||
expect(points).toHaveLength(5)
|
||||
})
|
||||
|
||||
it('should reference Stand Okt 2023', () => {
|
||||
expect(IFRS_ENDORSEMENT_WARNING).toContain('Stand Okt 2023')
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user