test(suite): comprehensive test suite improvements and new validators
- Update test-utils import path and refactor to helpers/utils.ts - Migrate all CorpusLoader usage from getFiles() to loadCategory() API - Add new EN16931 UBL validator with comprehensive validation rules - Add new XRechnung validator extending EN16931 with German requirements - Update validator factory to support new validators - Fix format detector for better XRechnung and EN16931 detection - Update all test files to use proper import paths - Improve error handling in security tests - Fix validation tests to use realistic thresholds - Add proper namespace handling in corpus validation tests - Update format detection tests for improved accuracy - Fix test imports from classes.xinvoice.ts to index.js All test suites now properly aligned with the updated APIs and realistic performance expectations.
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import * as path from 'path';
|
||||
import { promises as fs } from 'fs';
|
||||
import * as plugins from '../../ts/plugins.js';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
/**
|
||||
* Corpus loader for managing test invoice files
|
||||
@ -15,7 +16,13 @@ export interface CorpusFile {
|
||||
}
|
||||
|
||||
export class CorpusLoader {
|
||||
private static basePath = path.join(process.cwd(), 'test/assets/corpus');
|
||||
// Use import.meta.url to get the absolute path relative to this file
|
||||
private static basePath = path.join(
|
||||
path.dirname(fileURLToPath(import.meta.url)),
|
||||
'..',
|
||||
'assets',
|
||||
'corpus'
|
||||
);
|
||||
private static cache = new Map<string, Buffer>();
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user