add test, and fix script

This commit is contained in:
Warunee Tamkoo 2026-02-09 17:45:50 +07:00
parent 638362df1c
commit f9d626a499
6 changed files with 653 additions and 73 deletions

27
jest.config.js Normal file
View file

@ -0,0 +1,27 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
roots: ['<rootDir>/src'],
testMatch: ['**/__tests__/**/*.spec.ts', '**/__tests__/**/*.test.ts'],
transform: {
'^.+\\.ts$': ['ts-jest', {
diagnostics: {
ignoreCodes: [151002],
},
}],
},
collectCoverageFrom: [
'src/**/*.ts',
'!src/**/*.d.ts',
'!src/app.ts',
'!src/database/**',
'!src/__tests__/**',
],
coverageDirectory: 'coverage',
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
setupFilesAfterEnv: ['<rootDir>/src/__tests__/setup.ts'],
testTimeout: 10000,
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
};