Add comprehensive unit tests for Business Core modules: - Partners: 22 tests (CRUD, filters, tenant isolation) - Products: 23 tests (CRUD, categories, search) - Invoices: 31 tests (CRUD, payments, state transitions) - Warehouses: 24 tests (CRUD, locations, default handling) - HR Employees: 24 tests (CRUD, terminate/reactivate, subordinates) Test infrastructure: - jest.config.js with ts-jest and ESM support - setup.ts with mocks for AppDataSource and database - helpers.ts with factory functions for test data Total: 114 tests passing Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
33 lines
773 B
JavaScript
33 lines
773 B
JavaScript
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
|
module.exports = {
|
|
preset: 'ts-jest',
|
|
testEnvironment: 'node',
|
|
roots: ['<rootDir>/src'],
|
|
testMatch: [
|
|
'**/__tests__/**/*.test.ts',
|
|
'**/__tests__/**/*.spec.ts',
|
|
],
|
|
transform: {
|
|
'^.+\\.tsx?$': ['ts-jest', {
|
|
tsconfig: 'tsconfig.json',
|
|
useESM: true,
|
|
isolatedModules: true,
|
|
}],
|
|
},
|
|
moduleNameMapper: {
|
|
'^(\\.{1,2}/.*)\\.js$': '$1',
|
|
},
|
|
collectCoverageFrom: [
|
|
'src/**/*.ts',
|
|
'!src/**/*.d.ts',
|
|
'!src/**/index.ts',
|
|
'!src/config/**',
|
|
],
|
|
coverageDirectory: 'coverage',
|
|
coverageReporters: ['text', 'lcov', 'html'],
|
|
setupFilesAfterEnv: ['<rootDir>/src/__tests__/setup.ts'],
|
|
testTimeout: 30000,
|
|
verbose: true,
|
|
extensionsToTreatAsEsm: ['.ts'],
|
|
};
|