fix: 修正 Jest 配置中的文件路径,移除 next-auth mock
This commit is contained in:
@@ -18,7 +18,7 @@ module.exports = {
|
||||
},
|
||||
},
|
||||
coverageReporters: ['text', 'lcov', 'html', 'json'],
|
||||
coverageDirectory: 'coverage',
|
||||
coverageDirectory: '<rootDir>/coverage',
|
||||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
|
||||
moduleNameMapper: {
|
||||
'^@/(.*)$': '<rootDir>/src/$1',
|
||||
|
||||
@@ -4,37 +4,6 @@ const { TextEncoder, TextDecoder } = require('util');
|
||||
global.TextEncoder = TextEncoder;
|
||||
global.TextDecoder = TextDecoder;
|
||||
|
||||
jest.mock('next-auth', () => {
|
||||
return {
|
||||
__esModule: true,
|
||||
default: jest.fn(() => ({
|
||||
handlers: {
|
||||
authOptions: {
|
||||
providers: [],
|
||||
callbacks: {},
|
||||
pages: {},
|
||||
session: {},
|
||||
},
|
||||
},
|
||||
signIn: jest.fn(),
|
||||
signOut: jest.fn(),
|
||||
auth: jest.fn(),
|
||||
})),
|
||||
getServerSession: jest.fn(),
|
||||
};
|
||||
});
|
||||
|
||||
jest.mock('next-auth/providers/credentials', () =>
|
||||
jest.fn(() => ({
|
||||
name: '邮箱密码',
|
||||
credentials: {
|
||||
email: { label: '邮箱', type: 'email' },
|
||||
password: { label: '密码', type: 'password' },
|
||||
},
|
||||
authorize: jest.fn(),
|
||||
}))
|
||||
);
|
||||
|
||||
jest.mock('nanoid', () => ({
|
||||
nanoid: jest.fn(() => 'test-id-123'),
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user