[backend] fix: 修复异常处理和类型转换问题

This commit is contained in:
xsl
2026-01-26 11:53:40 +08:00
parent 7ccc2a6ac6
commit 83e05bf85f
28639 changed files with 2506458 additions and 93 deletions
+46
View File
@@ -0,0 +1,46 @@
import { describe, it, expect, vi } from 'vitest';
import { projectAPI } from './project';
vi.mock('../../services/api');
describe('projectAPI - TC-013', () => {
beforeEach(() => {
vi.clearAllMocks();
});
it('TC-013-06: projectAPI应该有getList方法', () => {
expect(typeof projectAPI.getList).toBe('function');
});
it('TC-013-07: projectAPI应该有getDetail方法', () => {
expect(typeof projectAPI.getDetail).toBe('function');
});
it('TC-013-08: projectAPI应该有create方法', () => {
expect(typeof projectAPI.create).toBe('function');
});
it('TC-013-09: projectAPI应该有update方法', () => {
expect(typeof projectAPI.update).toBe('function');
});
it('TC-013-10: projectAPI应该有delete方法', () => {
expect(typeof projectAPI.delete).toBe('function');
});
it('TC-013-11: projectAPI应该有getStatistics方法', () => {
expect(typeof projectAPI.getStatistics).toBe('function');
});
it('TC-013-12: projectAPI应该有getGroupStatistics方法', () => {
expect(typeof projectAPI.getGroupStatistics).toBe('function');
});
it('TC-013-13: projectAPI应该有getTimelineStatistics方法', () => {
expect(typeof projectAPI.getTimelineStatistics).toBe('function');
});
it('TC-013-14: projectAPI应该有export方法', () => {
expect(typeof projectAPI.export).toBe('function');
});
});
+34
View File
@@ -0,0 +1,34 @@
import { describe, it, expect, vi } from 'vitest';
import { userAPI } from './user';
vi.mock('../../services/api');
describe('userAPI - TC-014', () => {
beforeEach(() => {
vi.clearAllMocks();
});
it('TC-014-01: userAPI应该有getList方法', () => {
expect(typeof userAPI.getList).toBe('function');
});
it('TC-014-02: userAPI应该有getDetail方法', () => {
expect(typeof userAPI.getDetail).toBe('function');
});
it('TC-014-03: userAPI应该有create方法', () => {
expect(typeof userAPI.create).toBe('function');
});
it('TC-014-04: userAPI应该有update方法', () => {
expect(typeof userAPI.update).toBe('function');
});
it('TC-014-05: userAPI应该有delete方法', () => {
expect(typeof userAPI.delete).toBe('function');
});
it('TC-014-06: userAPI应该有resetPassword方法', () => {
expect(typeof userAPI.resetPassword).toBe('function');
});
});