From 32141f519a8f83b8172c78239dfd3e8d110907ab Mon Sep 17 00:00:00 2001 From: admin Date: Mon, 23 Mar 2026 09:54:31 +0700 Subject: [PATCH] 260323:0954 fix CI : Run Tests frontend #01 --- .../__tests__/use-correspondence.test.ts | 38 +- frontend/hooks/__tests__/use-drawing.test.ts | 50 +- frontend/hooks/__tests__/use-projects.test.ts | 16 +- frontend/hooks/__tests__/use-rfa.test.ts | 28 +- frontend/hooks/__tests__/use-users.test.ts | 16 +- .../__tests__/correspondence.service.test.ts | 63 +- .../__tests__/project.service.test.ts | 32 +- specs/88-logs/CI-error.md | 1393 ++++++----------- 8 files changed, 563 insertions(+), 1073 deletions(-) diff --git a/frontend/hooks/__tests__/use-correspondence.test.ts b/frontend/hooks/__tests__/use-correspondence.test.ts index d15110b..d0b784b 100644 --- a/frontend/hooks/__tests__/use-correspondence.test.ts +++ b/frontend/hooks/__tests__/use-correspondence.test.ts @@ -18,7 +18,7 @@ import { toast } from 'sonner'; vi.mock('@/lib/services/correspondence.service', () => ({ correspondenceService: { getAll: vi.fn(), - getById: vi.fn(), + getByUuid: vi.fn(), create: vi.fn(), update: vi.fn(), delete: vi.fn(), @@ -38,7 +38,7 @@ describe('use-correspondence hooks', () => { expect(correspondenceKeys.lists()).toEqual(['correspondences', 'list']); expect(correspondenceKeys.list({ projectId: 1 })).toEqual(['correspondences', 'list', { projectId: 1 }]); expect(correspondenceKeys.details()).toEqual(['correspondences', 'detail']); - expect(correspondenceKeys.detail(1)).toEqual(['correspondences', 'detail', 1]); + expect(correspondenceKeys.detail('uuid-1')).toEqual(['correspondences', 'detail', 'uuid-1']); }); }); @@ -81,27 +81,27 @@ describe('use-correspondence hooks', () => { }); describe('useCorrespondence', () => { - it('should fetch single correspondence by id', async () => { - const mockData = { id: 1, title: 'Test Correspondence' }; - vi.mocked(correspondenceService.getById).mockResolvedValue(mockData); + it('should fetch single correspondence by uuid', async () => { + const mockData = { id: 1, uuid: 'uuid-1', title: 'Test Correspondence' }; + vi.mocked(correspondenceService.getByUuid).mockResolvedValue(mockData); const { wrapper } = createTestQueryClient(); - const { result } = renderHook(() => useCorrespondence(1), { wrapper }); + const { result } = renderHook(() => useCorrespondence('uuid-1'), { wrapper }); await waitFor(() => { expect(result.current.isSuccess).toBe(true); }); expect(result.current.data).toEqual(mockData); - expect(correspondenceService.getById).toHaveBeenCalledWith(1); + expect(correspondenceService.getByUuid).toHaveBeenCalledWith('uuid-1'); }); - it('should not fetch when id is falsy', () => { + it('should not fetch when uuid is falsy', () => { const { wrapper } = createTestQueryClient(); - const { result } = renderHook(() => useCorrespondence(0), { wrapper }); + const { result } = renderHook(() => useCorrespondence(''), { wrapper }); expect(result.current.isFetching).toBe(false); - expect(correspondenceService.getById).not.toHaveBeenCalled(); + expect(correspondenceService.getByUuid).not.toHaveBeenCalled(); }); }); @@ -173,12 +173,12 @@ describe('use-correspondence hooks', () => { await act(async () => { await result.current.mutateAsync({ - id: 1, + uuid: 'uuid-1', data: { subject: 'Updated Correspondence' }, }); }); - expect(correspondenceService.update).toHaveBeenCalledWith(1, { + expect(correspondenceService.update).toHaveBeenCalledWith('uuid-1', { subject: 'Updated Correspondence', }); expect(toast.success).toHaveBeenCalledWith('Correspondence updated successfully'); @@ -193,10 +193,10 @@ describe('use-correspondence hooks', () => { const { result } = renderHook(() => useDeleteCorrespondence(), { wrapper }); await act(async () => { - await result.current.mutateAsync(1); + await result.current.mutateAsync('uuid-1'); }); - expect(correspondenceService.delete).toHaveBeenCalledWith(1); + expect(correspondenceService.delete).toHaveBeenCalledWith('uuid-1'); expect(toast.success).toHaveBeenCalledWith('Correspondence deleted successfully'); }); }); @@ -211,12 +211,12 @@ describe('use-correspondence hooks', () => { await act(async () => { await result.current.mutateAsync({ - id: 1, + uuid: 'uuid-1', data: { note: 'Ready for review' }, }); }); - expect(correspondenceService.submit).toHaveBeenCalledWith(1, { note: 'Ready for review' }); + expect(correspondenceService.submit).toHaveBeenCalledWith('uuid-1', { note: 'Ready for review' }); expect(toast.success).toHaveBeenCalledWith('Correspondence submitted successfully'); }); }); @@ -231,12 +231,12 @@ describe('use-correspondence hooks', () => { await act(async () => { await result.current.mutateAsync({ - id: 1, + uuid: 'uuid-1', data: { action: 'APPROVE', comments: 'LGTM' }, }); }); - expect(correspondenceService.processWorkflow).toHaveBeenCalledWith(1, { + expect(correspondenceService.processWorkflow).toHaveBeenCalledWith('uuid-1', { action: 'APPROVE', comments: 'LGTM', }); @@ -256,7 +256,7 @@ describe('use-correspondence hooks', () => { await act(async () => { try { await result.current.mutateAsync({ - id: 1, + uuid: 'uuid-1', data: { action: 'APPROVE' }, }); } catch { diff --git a/frontend/hooks/__tests__/use-drawing.test.ts b/frontend/hooks/__tests__/use-drawing.test.ts index be8de6f..9820d04 100644 --- a/frontend/hooks/__tests__/use-drawing.test.ts +++ b/frontend/hooks/__tests__/use-drawing.test.ts @@ -10,7 +10,7 @@ import { toast } from 'sonner'; vi.mock('@/lib/services/contract-drawing.service', () => ({ contractDrawingService: { getAll: vi.fn(), - getById: vi.fn(), + getByUuid: vi.fn(), create: vi.fn(), }, })); @@ -18,7 +18,7 @@ vi.mock('@/lib/services/contract-drawing.service', () => ({ vi.mock('@/lib/services/shop-drawing.service', () => ({ shopDrawingService: { getAll: vi.fn(), - getById: vi.fn(), + getByUuid: vi.fn(), create: vi.fn(), }, })); @@ -38,7 +38,7 @@ describe('use-drawing hooks', () => { 'CONTRACT', { projectId: 1 }, ]); - expect(drawingKeys.detail('SHOP', 1)).toEqual(['drawings', 'detail', 'SHOP', 1]); + expect(drawingKeys.detail('SHOP', 'uuid-1')).toEqual(['drawings', 'detail', 'SHOP', 'uuid-1']); }); }); @@ -46,8 +46,8 @@ describe('use-drawing hooks', () => { it('should fetch CONTRACT drawings successfully', async () => { const mockData = { data: [ - { id: 1, drawingNumber: 'CD-001' }, - { id: 2, drawingNumber: 'CD-002' }, + { id: 1, uuid: 'uuid-1', contractDrawingNo: 'CD-001' }, + { id: 2, uuid: 'uuid-2', contractDrawingNo: 'CD-002' }, ], meta: { total: 2, page: 1, limit: 10 }, }; @@ -61,14 +61,18 @@ describe('use-drawing hooks', () => { expect(result.current.isSuccess).toBe(true); }); - expect(result.current.data).toEqual(mockData); + expect(result.current.data.data[0]).toMatchObject({ + uuid: 'uuid-1', + drawingNumber: 'CD-001', + type: 'CONTRACT', + }); expect(contractDrawingService.getAll).toHaveBeenCalledWith({ projectId: 1 }); expect(shopDrawingService.getAll).not.toHaveBeenCalled(); }); it('should fetch SHOP drawings successfully', async () => { const mockData = { - data: [{ id: 1, drawingNumber: 'SD-001' }], + data: [{ id: 1, uuid: 'uuid-1' }], meta: { total: 1, page: 1, limit: 10 }, }; @@ -81,7 +85,11 @@ describe('use-drawing hooks', () => { expect(result.current.isSuccess).toBe(true); }); - expect(result.current.data).toEqual(mockData); + expect(result.current.data.data[0]).toMatchObject({ + uuid: 'uuid-1', + type: 'SHOP', + title: 'Untitled', + }); expect(shopDrawingService.getAll).toHaveBeenCalledWith({ projectId: 1 }); expect(contractDrawingService.getAll).not.toHaveBeenCalled(); }); @@ -100,42 +108,42 @@ describe('use-drawing hooks', () => { }); describe('useDrawing', () => { - it('should fetch single CONTRACT drawing by id', async () => { - const mockData = { id: 1, drawingNumber: 'CD-001' }; - vi.mocked(contractDrawingService.getById).mockResolvedValue(mockData); + it('should fetch single CONTRACT drawing by uuid', async () => { + const mockData = { id: 1, uuid: 'uuid-1', contractDrawingNo: 'CD-001' }; + vi.mocked(contractDrawingService.getByUuid).mockResolvedValue(mockData); const { wrapper } = createTestQueryClient(); - const { result } = renderHook(() => useDrawing('CONTRACT', 1), { wrapper }); + const { result } = renderHook(() => useDrawing('CONTRACT', 'uuid-1'), { wrapper }); await waitFor(() => { expect(result.current.isSuccess).toBe(true); }); expect(result.current.data).toEqual(mockData); - expect(contractDrawingService.getById).toHaveBeenCalledWith(1); + expect(contractDrawingService.getByUuid).toHaveBeenCalledWith('uuid-1'); }); - it('should fetch single SHOP drawing by id', async () => { - const mockData = { id: 1, drawingNumber: 'SD-001' }; - vi.mocked(shopDrawingService.getById).mockResolvedValue(mockData); + it('should fetch single SHOP drawing by uuid', async () => { + const mockData = { id: 1, uuid: 'uuid-1', title: 'SD-001' }; + vi.mocked(shopDrawingService.getByUuid).mockResolvedValue(mockData); const { wrapper } = createTestQueryClient(); - const { result } = renderHook(() => useDrawing('SHOP', 1), { wrapper }); + const { result } = renderHook(() => useDrawing('SHOP', 'uuid-1'), { wrapper }); await waitFor(() => { expect(result.current.isSuccess).toBe(true); }); expect(result.current.data).toEqual(mockData); - expect(shopDrawingService.getById).toHaveBeenCalledWith(1); + expect(shopDrawingService.getByUuid).toHaveBeenCalledWith('uuid-1'); }); - it('should not fetch when id is falsy', () => { + it('should not fetch when uuid is falsy', () => { const { wrapper } = createTestQueryClient(); - const { result } = renderHook(() => useDrawing('CONTRACT', 0), { wrapper }); + const { result } = renderHook(() => useDrawing('CONTRACT', ''), { wrapper }); expect(result.current.isFetching).toBe(false); - expect(contractDrawingService.getById).not.toHaveBeenCalled(); + expect(contractDrawingService.getByUuid).not.toHaveBeenCalled(); }); }); diff --git a/frontend/hooks/__tests__/use-projects.test.ts b/frontend/hooks/__tests__/use-projects.test.ts index bb26327..3118389 100644 --- a/frontend/hooks/__tests__/use-projects.test.ts +++ b/frontend/hooks/__tests__/use-projects.test.ts @@ -9,7 +9,7 @@ import { toast } from 'sonner'; vi.mock('@/lib/services/project.service', () => ({ projectService: { getAll: vi.fn(), - getById: vi.fn(), + getByUuid: vi.fn(), create: vi.fn(), update: vi.fn(), delete: vi.fn(), @@ -25,7 +25,7 @@ describe('use-projects hooks', () => { it('should generate correct cache keys', () => { expect(projectKeys.all).toEqual(['projects']); expect(projectKeys.list({ search: 'test' })).toEqual(['projects', 'list', { search: 'test' }]); - expect(projectKeys.detail(1)).toEqual(['projects', 'detail', 1]); + expect(projectKeys.detail('uuid-1')).toEqual(['projects', 'detail', 'uuid-1']); }); }); @@ -136,12 +136,12 @@ describe('use-projects hooks', () => { await act(async () => { await result.current.mutateAsync({ - id: 1, + uuid: 'uuid-1', data: { name: 'Updated Project' }, }); }); - expect(projectService.update).toHaveBeenCalledWith(1, { name: 'Updated Project' }); + expect(projectService.update).toHaveBeenCalledWith('uuid-1', { name: 'Updated Project' }); expect(toast.success).toHaveBeenCalledWith('Project updated successfully'); }); @@ -158,7 +158,7 @@ describe('use-projects hooks', () => { await act(async () => { try { await result.current.mutateAsync({ - id: 999, + uuid: 'uuid-999', data: { name: 'Test' }, }); } catch { @@ -180,10 +180,10 @@ describe('use-projects hooks', () => { const { result } = renderHook(() => useDeleteProject(), { wrapper }); await act(async () => { - await result.current.mutateAsync(1); + await result.current.mutateAsync('uuid-1'); }); - expect(projectService.delete).toHaveBeenCalledWith(1); + expect(projectService.delete).toHaveBeenCalledWith('uuid-1'); expect(toast.success).toHaveBeenCalledWith('Project deleted successfully'); }); @@ -199,7 +199,7 @@ describe('use-projects hooks', () => { await act(async () => { try { - await result.current.mutateAsync(1); + await result.current.mutateAsync('uuid-1'); } catch { // Expected } diff --git a/frontend/hooks/__tests__/use-rfa.test.ts b/frontend/hooks/__tests__/use-rfa.test.ts index 0ac789c..0fae607 100644 --- a/frontend/hooks/__tests__/use-rfa.test.ts +++ b/frontend/hooks/__tests__/use-rfa.test.ts @@ -9,7 +9,7 @@ import { toast } from 'sonner'; vi.mock('@/lib/services/rfa.service', () => ({ rfaService: { getAll: vi.fn(), - getById: vi.fn(), + getByUuid: vi.fn(), create: vi.fn(), update: vi.fn(), processWorkflow: vi.fn(), @@ -27,7 +27,7 @@ describe('use-rfa hooks', () => { expect(rfaKeys.lists()).toEqual(['rfas', 'list']); expect(rfaKeys.list({ projectId: 1 })).toEqual(['rfas', 'list', { projectId: 1 }]); expect(rfaKeys.details()).toEqual(['rfas', 'detail']); - expect(rfaKeys.detail(1)).toEqual(['rfas', 'detail', 1]); + expect(rfaKeys.detail('uuid-1')).toEqual(['rfas', 'detail', 'uuid-1']); }); }); @@ -67,27 +67,27 @@ describe('use-rfa hooks', () => { }); describe('useRFA', () => { - it('should fetch single RFA by id', async () => { - const mockData = { id: 1, rfaNumber: 'RFA-001', status: 'pending' }; - vi.mocked(rfaService.getById).mockResolvedValue(mockData); + it('should fetch single RFA by uuid', async () => { + const mockData = { id: 1, uuid: 'uuid-1', rfaNumber: 'RFA-001', status: 'pending' }; + vi.mocked(rfaService.getByUuid).mockResolvedValue(mockData); const { wrapper } = createTestQueryClient(); - const { result } = renderHook(() => useRFA(1), { wrapper }); + const { result } = renderHook(() => useRFA('uuid-1'), { wrapper }); await waitFor(() => { expect(result.current.isSuccess).toBe(true); }); expect(result.current.data).toEqual(mockData); - expect(rfaService.getById).toHaveBeenCalledWith(1); + expect(rfaService.getByUuid).toHaveBeenCalledWith('uuid-1'); }); - it('should not fetch when id is falsy', () => { + it('should not fetch when uuid is falsy', () => { const { wrapper } = createTestQueryClient(); - const { result } = renderHook(() => useRFA(0), { wrapper }); + const { result } = renderHook(() => useRFA(''), { wrapper }); expect(result.current.isFetching).toBe(false); - expect(rfaService.getById).not.toHaveBeenCalled(); + expect(rfaService.getByUuid).not.toHaveBeenCalled(); }); }); @@ -151,12 +151,12 @@ describe('use-rfa hooks', () => { await act(async () => { await result.current.mutateAsync({ - id: 1, + uuid: 'uuid-1', data: { subject: 'Updated RFA' }, }); }); - expect(rfaService.update).toHaveBeenCalledWith(1, { subject: 'Updated RFA' }); + expect(rfaService.update).toHaveBeenCalledWith('uuid-1', { subject: 'Updated RFA' }); expect(toast.success).toHaveBeenCalledWith('RFA updated successfully'); }); }); @@ -171,12 +171,12 @@ describe('use-rfa hooks', () => { await act(async () => { await result.current.mutateAsync({ - id: 1, + uuid: 'uuid-1', data: { action: 'APPROVE', comments: 'Approved' }, }); }); - expect(rfaService.processWorkflow).toHaveBeenCalledWith(1, { + expect(rfaService.processWorkflow).toHaveBeenCalledWith('uuid-1', { action: 'APPROVE', comments: 'Approved', }); diff --git a/frontend/hooks/__tests__/use-users.test.ts b/frontend/hooks/__tests__/use-users.test.ts index 1a185e4..3583d20 100644 --- a/frontend/hooks/__tests__/use-users.test.ts +++ b/frontend/hooks/__tests__/use-users.test.ts @@ -9,7 +9,7 @@ import { toast } from 'sonner'; vi.mock('@/lib/services/user.service', () => ({ userService: { getAll: vi.fn(), - getById: vi.fn(), + getByUuid: vi.fn(), create: vi.fn(), update: vi.fn(), delete: vi.fn(), @@ -26,7 +26,7 @@ describe('use-users hooks', () => { it('should generate correct cache keys', () => { expect(userKeys.all).toEqual(['users']); expect(userKeys.list({ search: 'john' })).toEqual(['users', 'list', { search: 'john' }]); - expect(userKeys.detail(1)).toEqual(['users', 'detail', 1]); + expect(userKeys.detail('uuid-1')).toEqual(['users', 'detail', 'uuid-1']); }); }); @@ -146,12 +146,12 @@ describe('use-users hooks', () => { await act(async () => { await result.current.mutateAsync({ - id: 1, + uuid: 'uuid-1', data: { email: 'updated@example.com' }, }); }); - expect(userService.update).toHaveBeenCalledWith(1, { email: 'updated@example.com' }); + expect(userService.update).toHaveBeenCalledWith('uuid-1', { email: 'updated@example.com' }); expect(toast.success).toHaveBeenCalledWith('User updated successfully'); }); @@ -168,7 +168,7 @@ describe('use-users hooks', () => { await act(async () => { try { await result.current.mutateAsync({ - id: 999, + uuid: 'uuid-999', data: { email: 'test@example.com' }, }); } catch { @@ -190,10 +190,10 @@ describe('use-users hooks', () => { const { result } = renderHook(() => useDeleteUser(), { wrapper }); await act(async () => { - await result.current.mutateAsync(1); + await result.current.mutateAsync('uuid-1'); }); - expect(userService.delete).toHaveBeenCalledWith(1); + expect(userService.delete).toHaveBeenCalledWith('uuid-1'); expect(toast.success).toHaveBeenCalledWith('User deleted successfully'); }); @@ -209,7 +209,7 @@ describe('use-users hooks', () => { await act(async () => { try { - await result.current.mutateAsync(1); + await result.current.mutateAsync('uuid-1'); } catch { // Expected } diff --git a/frontend/lib/services/__tests__/correspondence.service.test.ts b/frontend/lib/services/__tests__/correspondence.service.test.ts index 7d3d724..33a8a08 100644 --- a/frontend/lib/services/__tests__/correspondence.service.test.ts +++ b/frontend/lib/services/__tests__/correspondence.service.test.ts @@ -38,26 +38,17 @@ describe('correspondenceService', () => { }); }); - describe('getById', () => { - it('should call GET /correspondences/:id', async () => { - const mockData = { id: 1, subject: 'Test' }; + describe('getByUuid', () => { + it('should call GET /correspondences/:uuid', async () => { + const mockData = { id: 1, uuid: 'uuid-1', subject: 'Test' }; // Service expects response.data.data (NestJS interceptor wrapper) vi.mocked(apiClient.get).mockResolvedValue({ data: { data: mockData } }); - const result = await correspondenceService.getById(1); + const result = await correspondenceService.getByUuid('uuid-1'); - expect(apiClient.get).toHaveBeenCalledWith('/correspondences/1'); + expect(apiClient.get).toHaveBeenCalledWith('/correspondences/uuid-1'); expect(result).toEqual(mockData); }); - - it('should work with string id', async () => { - const mockData = { id: 1 }; - vi.mocked(apiClient.get).mockResolvedValue({ data: { data: mockData } }); - - await correspondenceService.getById('123'); - - expect(apiClient.get).toHaveBeenCalledWith('/correspondences/123'); - }); }); describe('create', () => { @@ -78,76 +69,76 @@ describe('correspondenceService', () => { }); describe('update', () => { - it('should call PUT /correspondences/:id with data', async () => { + it('should call PUT /correspondences/:uuid with data', async () => { const updateData = { subject: 'Updated Title' }; - const mockResponse = { id: 1, subject: 'Updated Title' }; + const mockResponse = { id: 1, uuid: 'uuid-1', subject: 'Updated Title' }; vi.mocked(apiClient.put).mockResolvedValue({ data: mockResponse }); - const result = await correspondenceService.update(1, updateData); + const result = await correspondenceService.update('uuid-1', updateData); - expect(apiClient.put).toHaveBeenCalledWith('/correspondences/1', updateData); + expect(apiClient.put).toHaveBeenCalledWith('/correspondences/uuid-1', updateData); expect(result).toEqual(mockResponse); }); }); describe('delete', () => { - it('should call DELETE /correspondences/:id', async () => { + it('should call DELETE /correspondences/:uuid', async () => { vi.mocked(apiClient.delete).mockResolvedValue({ data: {} }); - const result = await correspondenceService.delete(1); + const result = await correspondenceService.delete('uuid-1'); - expect(apiClient.delete).toHaveBeenCalledWith('/correspondences/1'); + expect(apiClient.delete).toHaveBeenCalledWith('/correspondences/uuid-1'); expect(result).toEqual({}); }); }); describe('submit', () => { - it('should call POST /correspondences/:id/submit', async () => { + it('should call POST /correspondences/:uuid/submit', async () => { const submitDto = { note: 'Ready for review' }; - const mockResponse = { id: 1, status: 'submitted' }; + const mockResponse = { id: 1, uuid: 'uuid-1', status: 'submitted' }; vi.mocked(apiClient.post).mockResolvedValue({ data: mockResponse }); - const result = await correspondenceService.submit(1, submitDto); + const result = await correspondenceService.submit('uuid-1', submitDto); - expect(apiClient.post).toHaveBeenCalledWith('/correspondences/1/submit', submitDto); + expect(apiClient.post).toHaveBeenCalledWith('/correspondences/uuid-1/submit', submitDto); expect(result).toEqual(mockResponse); }); }); describe('processWorkflow', () => { - it('should call POST /correspondences/:id/workflow', async () => { + it('should call POST /correspondences/:uuid/workflow', async () => { const workflowDto: WorkflowActionDto = { action: 'APPROVE', comments: 'LGTM' }; - const mockResponse = { id: 1, status: 'approved' }; + const mockResponse = { id: 1, uuid: 'uuid-1', status: 'approved' }; vi.mocked(apiClient.post).mockResolvedValue({ data: mockResponse }); - const result = await correspondenceService.processWorkflow(1, workflowDto); + const result = await correspondenceService.processWorkflow('uuid-1', workflowDto); - expect(apiClient.post).toHaveBeenCalledWith('/correspondences/1/workflow', workflowDto); + expect(apiClient.post).toHaveBeenCalledWith('/correspondences/uuid-1/workflow', workflowDto); expect(result).toEqual(mockResponse); }); }); describe('addReference', () => { - it('should call POST /correspondences/:id/references', async () => { + it('should call POST /correspondences/:uuid/references', async () => { const referenceDto = { targetId: 2, referenceType: 'reply_to' }; - const mockResponse = { id: 1 }; + const mockResponse = { id: 1, uuid: 'uuid-1' }; vi.mocked(apiClient.post).mockResolvedValue({ data: mockResponse }); - const result = await correspondenceService.addReference(1, referenceDto); + const result = await correspondenceService.addReference('uuid-1', referenceDto); - expect(apiClient.post).toHaveBeenCalledWith('/correspondences/1/references', referenceDto); + expect(apiClient.post).toHaveBeenCalledWith('/correspondences/uuid-1/references', referenceDto); expect(result).toEqual(mockResponse); }); }); describe('removeReference', () => { - it('should call DELETE /correspondences/:id/references with body', async () => { + it('should call DELETE /correspondences/:uuid/references with body', async () => { const referenceDto = { targetId: 2 }; vi.mocked(apiClient.delete).mockResolvedValue({ data: {} }); - const result = await correspondenceService.removeReference(1, referenceDto); + const result = await correspondenceService.removeReference('uuid-1', referenceDto); - expect(apiClient.delete).toHaveBeenCalledWith('/correspondences/1/references', { + expect(apiClient.delete).toHaveBeenCalledWith('/correspondences/uuid-1/references', { data: referenceDto, }); expect(result).toEqual({}); diff --git a/frontend/lib/services/__tests__/project.service.test.ts b/frontend/lib/services/__tests__/project.service.test.ts index daf4e6c..f99b246 100644 --- a/frontend/lib/services/__tests__/project.service.test.ts +++ b/frontend/lib/services/__tests__/project.service.test.ts @@ -34,24 +34,16 @@ describe('projectService', () => { }); }); - describe('getById', () => { - it('should call GET /projects/:id', async () => { - const mockResponse = { id: 1, name: 'Project Alpha', code: 'P-001' }; + describe('getByUuid', () => { + it('should call GET /projects/:uuid', async () => { + const mockResponse = { id: 1, uuid: 'uuid-1', name: 'Project Alpha', code: 'P-001' }; vi.mocked(apiClient.get).mockResolvedValue({ data: mockResponse }); - const result = await projectService.getById(1); + const result = await projectService.getByUuid('uuid-1'); - expect(apiClient.get).toHaveBeenCalledWith('/projects/1'); + expect(apiClient.get).toHaveBeenCalledWith('/projects/uuid-1'); expect(result).toEqual(mockResponse); }); - - it('should work with string id', async () => { - vi.mocked(apiClient.get).mockResolvedValue({ data: {} }); - - await projectService.getById('123'); - - expect(apiClient.get).toHaveBeenCalledWith('/projects/123'); - }); }); describe('create', () => { @@ -68,25 +60,25 @@ describe('projectService', () => { }); describe('update', () => { - it('should call PUT /projects/:id with data', async () => { + it('should call PUT /projects/:uuid with data', async () => { const updateData = { projectName: 'Updated Project' }; - const mockResponse = { id: 1, projectName: 'Updated Project' }; + const mockResponse = { id: 1, uuid: 'uuid-1', projectName: 'Updated Project' }; vi.mocked(apiClient.put).mockResolvedValue({ data: mockResponse }); - const result = await projectService.update(1, updateData); + const result = await projectService.update('uuid-1', updateData); - expect(apiClient.put).toHaveBeenCalledWith('/projects/1', updateData); + expect(apiClient.put).toHaveBeenCalledWith('/projects/uuid-1', updateData); expect(result).toEqual(mockResponse); }); }); describe('delete', () => { - it('should call DELETE /projects/:id', async () => { + it('should call DELETE /projects/:uuid', async () => { vi.mocked(apiClient.delete).mockResolvedValue({ data: {} }); - const result = await projectService.delete(1); + const result = await projectService.delete('uuid-1'); - expect(apiClient.delete).toHaveBeenCalledWith('/projects/1'); + expect(apiClient.delete).toHaveBeenCalledWith('/projects/uuid-1'); expect(result).toEqual({}); }); }); diff --git a/specs/88-logs/CI-error.md b/specs/88-logs/CI-error.md index a564d92..2d2c074 100644 --- a/specs/88-logs/CI-error.md +++ b/specs/88-logs/CI-error.md @@ -1,950 +1,449 @@ -🧪 Run Tests -18s -> backend@1.8.1 test /workspace/np-dms/lcbp3/backend -> jest --forceExit --watchAll=false -[Nest] 446 - 03/23/2026, 1:50:33 AM ERROR [WorkflowEngineService] Transition Failed for inst-1: DB Error -PASS src/modules/workflow-engine/workflow-engine.service.spec.ts -FAIL src/common/auth/auth.service.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 1 | import { Column, BeforeInsert } from 'typeorm'; - >[***m 2 | import { v7 as uuidv7 } from 'uuid'; - | ^[***m - 3 | - 4 | /** - 5 | * Abstract base entity providing a UUID public identifier column. - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (common/entities/uuid-base.entity.ts:2:1) - at Object. (modules/organization/entities/organization.entity.ts:13:1) - at Object. (modules/user/entities/user.entity.ts:16:1) - at Object. (modules/user/user.service.ts:15:1) - at Object. (common/auth/auth.service.ts:24:1) - at Object. (common/auth/auth.service.spec.ts:2:1) -FAIL src/modules/correspondence/correspondence.service.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 6 | BeforeInsert, - 7 | } from 'typeorm'; - >[***m 8 | import { v7 as uuidv7 } from 'uuid'; - | ^[***m - 9 | import { Exclude, Expose } from 'class-transformer'; - 10 | import { BaseEntity } from '../../../common/entities/base.entity'; - 11 | import { Contract } from '../../contract/entities/contract.entity'; - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (modules/project/entities/project.entity.ts:8:1) - at Object. (modules/correspondence/entities/correspondence.entity.ts:11:1) - at Object. (modules/correspondence/correspondence.service.ts:15:1) - at Object. (modules/correspondence/correspondence.service.spec.ts:4:1) -PASS src/common/services/uuid-resolver.service.spec.ts -FAIL src/modules/document-numbering/document-numbering.service.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 6 | BeforeInsert, - 7 | } from 'typeorm'; - >[***m 8 | import { v7 as uuidv7 } from 'uuid'; - | ^[***m - 9 | import { Exclude, Expose } from 'class-transformer'; - 10 | import { BaseEntity } from '../../../common/entities/base.entity'; - 11 | import { Contract } from '../../contract/entities/contract.entity'; - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (modules/project/entities/project.entity.ts:8:1) - at Object. (modules/document-numbering/entities/document-number-format.entity.ts:13:1) - at Object. (modules/document-numbering/services/document-numbering.service.ts:6:1) - at Object. (modules/document-numbering/document-numbering.service.spec.ts:3:1) -PASS src/modules/workflow-engine/dsl/parser.service.spec.ts -FAIL src/common/auth/casl/ability.factory.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 1 | import { Column, BeforeInsert } from 'typeorm'; - >[***m 2 | import { v7 as uuidv7 } from 'uuid'; - | ^[***m - 3 | - 4 | /** - 5 | * Abstract base entity providing a UUID public identifier column. - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (common/entities/uuid-base.entity.ts:2:1) - at Object. (modules/organization/entities/organization.entity.ts:13:1) - at Object. (modules/user/entities/user.entity.ts:16:1) - at Object. (common/auth/casl/ability.factory.spec.ts:3:1) -FAIL src/common/file-storage/file-storage.service.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 12 | import * as path from 'path'; - 13 | import * as crypto from 'crypto'; - >[***m 14 | import { v4 as uuidv4 } from 'uuid'; - | ^[***m - 15 | import { Attachment } from './entities/attachment.entity'; - 16 | import { ForbiddenException } from '@nestjs/common'; // ✅ Import เพิ่ม - 17 | - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (common/file-storage/file-storage.service.ts:14:1) - at Object. (common/file-storage/file-storage.service.spec.ts:2:1) -FAIL src/modules/user/user.service.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 1 | import { Column, BeforeInsert } from 'typeorm'; - >[***m 2 | import { v7 as uuidv7 } from 'uuid'; - | ^[***m - 3 | - 4 | /** - 5 | * Abstract base entity providing a UUID public identifier column. - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (common/entities/uuid-base.entity.ts:2:1) - at Object. (modules/organization/entities/organization.entity.ts:13:1) - at Object. (modules/user/entities/user.entity.ts:16:1) - at Object. (modules/user/user.service.ts:15:1) - at Object. (modules/user/user.service.spec.ts:5:1) -PASS src/common/pipes/parse-uuid.pipe.spec.ts -FAIL src/modules/correspondence/correspondence.controller.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 6 | BeforeInsert, - 7 | } from 'typeorm'; - >[***m 8 | import { v7 as uuidv7 } from 'uuid'; - | ^[***m - 9 | import { Exclude, Expose } from 'class-transformer'; - 10 | import { BaseEntity } from '../../../common/entities/base.entity'; - 11 | import { Contract } from '../../contract/entities/contract.entity'; - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (modules/project/entities/project.entity.ts:8:1) - at Object. (modules/correspondence/entities/correspondence.entity.ts:11:1) - at Object. (modules/correspondence/correspondence.service.ts:15:1) - at Object. (modules/correspondence/correspondence.controller.ts:19:1) - at Object. (modules/correspondence/correspondence.controller.spec.ts:2:1) -FAIL src/modules/project/project.service.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 6 | BeforeInsert, - 7 | } from 'typeorm'; - >[***m 8 | import { v7 as uuidv7 } from 'uuid'; - | ^[***m - 9 | import { Exclude, Expose } from 'class-transformer'; - 10 | import { BaseEntity } from '../../../common/entities/base.entity'; - 11 | import { Contract } from '../../contract/entities/contract.entity'; - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (modules/project/entities/project.entity.ts:8:1) - at Object. (modules/project/project.service.ts:11:1) - at Object. (modules/project/project.service.spec.ts:3:1) -PASS src/common/entities/uuid-base.entity.spec.ts -FAIL src/common/auth/auth.controller.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 1 | import { Column, BeforeInsert } from 'typeorm'; - >[***m 2 | import { v7 as uuidv7 } from 'uuid'; - | ^[***m - 3 | - 4 | /** - 5 | * Abstract base entity providing a UUID public identifier column. - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (common/entities/uuid-base.entity.ts:2:1) - at Object. (modules/organization/entities/organization.entity.ts:13:1) - at Object. (modules/user/entities/user.entity.ts:16:1) - at Object. (modules/user/user.service.ts:15:1) - at Object. (common/auth/auth.service.ts:24:1) - at Object. (common/auth/auth.controller.ts:18:1) - at Object. (common/auth/auth.controller.spec.ts:3:1) -FAIL src/modules/migration/migration.service.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 6 | BeforeInsert, - 7 | } from 'typeorm'; - >[***m 8 | import { v7 as uuidv7 } from 'uuid'; - | ^[***m - 9 | import { Exclude, Expose } from 'class-transformer'; - 10 | import { BaseEntity } from '../../../common/entities/base.entity'; - 11 | import { Contract } from '../../contract/entities/contract.entity'; - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (modules/project/entities/project.entity.ts:8:1) - at Object. (modules/correspondence/entities/correspondence.entity.ts:11:1) - at Object. (modules/migration/migration.service.ts:15:1) - at Object. (modules/migration/migration.service.spec.ts:2:1) -FAIL src/modules/project/project.controller.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 6 | BeforeInsert, - 7 | } from 'typeorm'; - >[***m 8 | import { v7 as uuidv7 } from 'uuid'; - | ^[***m - 9 | import { Exclude, Expose } from 'class-transformer'; - 10 | import { BaseEntity } from '../../../common/entities/base.entity'; - 11 | import { Contract } from '../../contract/entities/contract.entity'; - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (modules/project/entities/project.entity.ts:8:1) - at Object. (modules/project/project.service.ts:11:1) - at Object. (modules/project/project.controller.ts:14:1) - at Object. (modules/project/project.controller.spec.ts:2:1) -PASS src/modules/document-numbering/services/manual-override.service.spec.ts -FAIL src/modules/migration/migration.controller.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 6 | BeforeInsert, - 7 | } from 'typeorm'; - >[***m 8 | import { v7 as uuidv7 } from 'uuid'; - | ^[***m - 9 | import { Exclude, Expose } from 'class-transformer'; - 10 | import { BaseEntity } from '../../../common/entities/base.entity'; - 11 | import { Contract } from '../../contract/entities/contract.entity'; - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (modules/project/entities/project.entity.ts:8:1) - at Object. (modules/correspondence/entities/correspondence.entity.ts:11:1) - at Object. (modules/migration/migration.service.ts:15:1) - at Object. (modules/migration/migration.controller.ts:13:1) - at Object. (modules/migration/migration.controller.spec.ts:2:1) -FAIL src/common/file-storage/file-storage.controller.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 12 | import * as path from 'path'; - 13 | import * as crypto from 'crypto'; - >[***m 14 | import { v4 as uuidv4 } from 'uuid'; - | ^[***m - 15 | import { Attachment } from './entities/attachment.entity'; - 16 | import { ForbiddenException } from '@nestjs/common'; // ✅ Import เพิ่ม - 17 | - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (common/file-storage/file-storage.service.ts:14:1) - at Object. (common/file-storage/file-storage.controller.ts:21:1) - at Object. (common/file-storage/file-storage.controller.spec.ts:2:1) -PASS src/app.controller.spec.ts -FAIL src/modules/json-schema/json-schema.controller.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 1 | import { Column, BeforeInsert } from 'typeorm'; - >[***m 2 | import { v7 as uuidv7 } from 'uuid'; - | ^[***m - 3 | - 4 | /** - 5 | * Abstract base entity providing a UUID public identifier column. - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (common/entities/uuid-base.entity.ts:2:1) - at Object. (modules/organization/entities/organization.entity.ts:13:1) - at Object. (modules/user/entities/user.entity.ts:16:1) - at Object. (modules/user/user.service.ts:15:1) - at Object. (common/guards/rbac.guard.ts:9:1) - at Object. (modules/json-schema/json-schema.controller.ts:35:1) - at Object. (modules/json-schema/json-schema.controller.spec.ts:2:1) -Summary of all failing tests -FAIL common/auth/auth.service.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 1 | import { Column, BeforeInsert } from 'typeorm'; - >[***m 2 | import { v7 as uuidv7 } from 'uuid'; - | ^[***m - 3 | - 4 | /** - 5 | * Abstract base entity providing a UUID public identifier column. - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (common/entities/uuid-base.entity.ts:2:1) - at Object. (modules/organization/entities/organization.entity.ts:13:1) - at Object. (modules/user/entities/user.entity.ts:16:1) - at Object. (modules/user/user.service.ts:15:1) - at Object. (common/auth/auth.service.ts:24:1) - at Object. (common/auth/auth.service.spec.ts:2:1) -FAIL modules/correspondence/correspondence.service.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 6 | BeforeInsert, - 7 | } from 'typeorm'; - >[***m 8 | import { v7 as uuidv7 } from 'uuid'; - | ^[***m - 9 | import { Exclude, Expose } from 'class-transformer'; - 10 | import { BaseEntity } from '../../../common/entities/base.entity'; - 11 | import { Contract } from '../../contract/entities/contract.entity'; - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (modules/project/entities/project.entity.ts:8:1) - at Object. (modules/correspondence/entities/correspondence.entity.ts:11:1) - at Object. (modules/correspondence/correspondence.service.ts:15:1) - at Object. (modules/correspondence/correspondence.service.spec.ts:4:1) -FAIL modules/document-numbering/document-numbering.service.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 6 | BeforeInsert, - 7 | } from 'typeorm'; - >[***m 8 | import { v7 as uuidv7 } from 'uuid'; - | ^[***m - 9 | import { Exclude, Expose } from 'class-transformer'; - 10 | import { BaseEntity } from '../../../common/entities/base.entity'; - 11 | import { Contract } from '../../contract/entities/contract.entity'; - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (modules/project/entities/project.entity.ts:8:1) - at Object. (modules/document-numbering/entities/document-number-format.entity.ts:13:1) - at Object. (modules/document-numbering/services/document-numbering.service.ts:6:1) - at Object. (modules/document-numbering/document-numbering.service.spec.ts:3:1) -FAIL common/auth/casl/ability.factory.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 1 | import { Column, BeforeInsert } from 'typeorm'; - >[***m 2 | import { v7 as uuidv7 } from 'uuid'; - | ^[***m - 3 | - 4 | /** - 5 | * Abstract base entity providing a UUID public identifier column. - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (common/entities/uuid-base.entity.ts:2:1) - at Object. (modules/organization/entities/organization.entity.ts:13:1) - at Object. (modules/user/entities/user.entity.ts:16:1) - at Object. (common/auth/casl/ability.factory.spec.ts:3:1) -FAIL common/file-storage/file-storage.service.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 12 | import * as path from 'path'; - 13 | import * as crypto from 'crypto'; - >[***m 14 | import { v4 as uuidv4 } from 'uuid'; - | ^[***m - 15 | import { Attachment } from './entities/attachment.entity'; - 16 | import { ForbiddenException } from '@nestjs/common'; // ✅ Import เพิ่ม - 17 | - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (common/file-storage/file-storage.service.ts:14:1) - at Object. (common/file-storage/file-storage.service.spec.ts:2:1) -FAIL modules/user/user.service.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 1 | import { Column, BeforeInsert } from 'typeorm'; - >[***m 2 | import { v7 as uuidv7 } from 'uuid'; - | ^[***m - 3 | - 4 | /** - 5 | * Abstract base entity providing a UUID public identifier column. - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (common/entities/uuid-base.entity.ts:2:1) - at Object. (modules/organization/entities/organization.entity.ts:13:1) - at Object. (modules/user/entities/user.entity.ts:16:1) - at Object. (modules/user/user.service.ts:15:1) - at Object. (modules/user/user.service.spec.ts:5:1) -FAIL modules/correspondence/correspondence.controller.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 6 | BeforeInsert, - 7 | } from 'typeorm'; - >[***m 8 | import { v7 as uuidv7 } from 'uuid'; - | ^[***m - 9 | import { Exclude, Expose } from 'class-transformer'; - 10 | import { BaseEntity } from '../../../common/entities/base.entity'; - 11 | import { Contract } from '../../contract/entities/contract.entity'; - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (modules/project/entities/project.entity.ts:8:1) - at Object. (modules/correspondence/entities/correspondence.entity.ts:11:1) - at Object. (modules/correspondence/correspondence.service.ts:15:1) - at Object. (modules/correspondence/correspondence.controller.ts:19:1) - at Object. (modules/correspondence/correspondence.controller.spec.ts:2:1) -FAIL modules/project/project.service.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 6 | BeforeInsert, - 7 | } from 'typeorm'; - >[***m 8 | import { v7 as uuidv7 } from 'uuid'; - | ^[***m - 9 | import { Exclude, Expose } from 'class-transformer'; - 10 | import { BaseEntity } from '../../../common/entities/base.entity'; - 11 | import { Contract } from '../../contract/entities/contract.entity'; - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (modules/project/entities/project.entity.ts:8:1) - at Object. (modules/project/project.service.ts:11:1) - at Object. (modules/project/project.service.spec.ts:3:1) -FAIL common/auth/auth.controller.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 1 | import { Column, BeforeInsert } from 'typeorm'; - >[***m 2 | import { v7 as uuidv7 } from 'uuid'; - | ^[***m - 3 | - 4 | /** - 5 | * Abstract base entity providing a UUID public identifier column. - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (common/entities/uuid-base.entity.ts:2:1) - at Object. (modules/organization/entities/organization.entity.ts:13:1) - at Object. (modules/user/entities/user.entity.ts:16:1) - at Object. (modules/user/user.service.ts:15:1) - at Object. (common/auth/auth.service.ts:24:1) - at Object. (common/auth/auth.controller.ts:18:1) - at Object. (common/auth/auth.controller.spec.ts:3:1) -FAIL modules/migration/migration.service.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 6 | BeforeInsert, - 7 | } from 'typeorm'; - >[***m 8 | import { v7 as uuidv7 } from 'uuid'; - | ^[***m - 9 | import { Exclude, Expose } from 'class-transformer'; - 10 | import { BaseEntity } from '../../../common/entities/base.entity'; - 11 | import { Contract } from '../../contract/entities/contract.entity'; - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (modules/project/entities/project.entity.ts:8:1) - at Object. (modules/correspondence/entities/correspondence.entity.ts:11:1) - at Object. (modules/migration/migration.service.ts:15:1) - at Object. (modules/migration/migration.service.spec.ts:2:1) -FAIL modules/project/project.controller.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 6 | BeforeInsert, - 7 | } from 'typeorm'; - >[***m 8 | import { v7 as uuidv7 } from 'uuid'; - | ^[***m - 9 | import { Exclude, Expose } from 'class-transformer'; - 10 | import { BaseEntity } from '../../../common/entities/base.entity'; - 11 | import { Contract } from '../../contract/entities/contract.entity'; - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (modules/project/entities/project.entity.ts:8:1) - at Object. (modules/project/project.service.ts:11:1) - at Object. (modules/project/project.controller.ts:14:1) - at Object. (modules/project/project.controller.spec.ts:2:1) -FAIL modules/migration/migration.controller.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 6 | BeforeInsert, - 7 | } from 'typeorm'; - >[***m 8 | import { v7 as uuidv7 } from 'uuid'; - | ^[***m - 9 | import { Exclude, Expose } from 'class-transformer'; - 10 | import { BaseEntity } from '../../../common/entities/base.entity'; - 11 | import { Contract } from '../../contract/entities/contract.entity'; - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (modules/project/entities/project.entity.ts:8:1) - at Object. (modules/correspondence/entities/correspondence.entity.ts:11:1) - at Object. (modules/migration/migration.service.ts:15:1) - at Object. (modules/migration/migration.controller.ts:13:1) - at Object. (modules/migration/migration.controller.spec.ts:2:1) -FAIL common/file-storage/file-storage.controller.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 12 | import * as path from 'path'; - 13 | import * as crypto from 'crypto'; - >[***m 14 | import { v4 as uuidv4 } from 'uuid'; - | ^[***m - 15 | import { Attachment } from './entities/attachment.entity'; - 16 | import { ForbiddenException } from '@nestjs/common'; // ✅ Import เพิ่ม - 17 | - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (common/file-storage/file-storage.service.ts:14:1) - at Object. (common/file-storage/file-storage.controller.ts:21:1) - at Object. (common/file-storage/file-storage.controller.spec.ts:2:1) -FAIL modules/json-schema/json-schema.controller.spec.ts - ● Test suite failed to run - Jest encountered an unexpected token - Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. - Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration. - By default "node_modules" folder is ignored by transformers. - Here's what you can do: - • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it. - • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript - • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. - • If you need a custom transformation, specify a "transform" option in your config. - • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. - You'll find more details and examples of these config options in the docs: - https://jestjs.io/docs/configuration - For information about custom transformations, see: - https://jestjs.io/docs/code-transformation - Details: - /workspace/np-dms/lcbp3/node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist-node/index.js:1 - export { default as MAX } from './max.js'; - ^^^^^^ - SyntaxError: Unexpected token 'export' - 1 | import { Column, BeforeInsert } from 'typeorm'; - >[***m 2 | import { v7 as uuidv7 } from 'uuid'; - | ^[***m - 3 | - 4 | /** - 5 | * Abstract base entity providing a UUID public identifier column. - at Runtime.createScriptFromCode (../../node_modules/.pnpm/jest-runtime@30.2.0/node_modules/jest-runtime/build/index.js:1318:40) - at Object. (common/entities/uuid-base.entity.ts:2:1) - at Object. (modules/organization/entities/organization.entity.ts:13:1) - at Object. (modules/user/entities/user.entity.ts:16:1) - at Object. (modules/user/user.service.ts:15:1) - at Object. (common/guards/rbac.guard.ts:9:1) - at Object. (modules/json-schema/json-schema.controller.ts:35:1) - at Object. (modules/json-schema/json-schema.controller.spec.ts:2:1) -Test Suites: 14 failed, 7 passed, 21 total -Tests: 51 passed, 51 total -Snapshots: 0 total -Time: 15.419 s -Ran all test suites. -Force exiting Jest: Have you considered using `--detectOpenHandles` to detect async operations that kept running after all tests finished? +> lcbp3-frontend@1.8.1 test /workspace/np-dms/lcbp3/frontend +> vitest run + RUN [***m v4.1.0 /workspace/np-dms/lcbp3/frontend + ✓ lib/services/__tests__/master-data.service.test.ts ([***m26 tests[***m)[***m 58ms[***m + ❯ hooks/__tests__/use-correspondence.test.ts ([***m12 tests[***m | [***m4 failed)[***m 13***ms[***m + ✓ should generate correct cache keys 9ms[***m + ✓ should fetch correspondences successfully 101ms[***m + ✓ should handle error state 62ms[***m + × should fetch single correspondence by id 1050ms[***m + ✓ should not fetch when id is falsy 7ms[***m + ✓ should create correspondence and show success toast 11ms[***m + ✓ should show error toast on failure 7ms[***m + × should update correspondence and invalidate cache 10ms[***m + ✓ should delete correspondence and show success toast 6ms[***m + × should submit correspondence for workflow 9ms[***m + × should process workflow action 20ms[***m + ✓ should handle workflow action error ***ms[***m + ❯ hooks/__tests__/use-drawing.test.ts ([***m10 tests[***m | [***m4 failed)[***m 2331ms[***m + ✓ should generate correct cache keys 6ms[***m + × should fetch CONTRACT drawings successfully 121ms[***m + × should fetch SHOP drawings successfully 69ms[***m + ✓ should handle error state 58ms[***m + × should fetch single CONTRACT drawing by id 1028ms[***m + × should fetch single SHOP drawing by id 1013ms[***m + ✓ should not fetch when id is falsy 6ms[***m + ✓ should create CONTRACT drawing and show success toast 11ms[***m + ✓ should create SHOP drawing and show success toast 6ms[***m + ✓ should show error toast on failure 7ms[***m + ❯ hooks/__tests__/use-users.test.ts ([***m10 tests[***m | [***m1 failed)[***m 311ms[***m + ✓ should generate correct cache keys 5ms[***m + ✓ should fetch users successfully 94ms[***m + ✓ should handle error state 62ms[***m + ✓ should fetch roles successfully 66ms[***m + ✓ should create user and show success toast 15ms[***m + ✓ should show error toast on failure 7ms[***m + × should update user and show success toast 23ms[***m + ✓ should show error toast on failure 7ms[***m + ✓ should delete user and show success toast 14ms[***m + ✓ should show error toast on delete failure 8ms[***m + ❯ hooks/__tests__/use-projects.test.ts ([***m10 tests[***m | [***m1 failed)[***m 321ms[***m + ✓ should generate correct cache keys 6ms[***m + ✓ should fetch projects successfully 98ms[***m + ✓ should fetch projects without params 62ms[***m + ✓ should handle error state 61ms[***m + ✓ should create project and show success toast 13ms[***m + ✓ should show error toast on failure 8ms[***m + × should update project and show success toast 34ms[***m + ✓ should show error toast on failure 7ms[***m + ✓ should delete project and show success toast 10ms[***m + ✓ should show error toast on delete failure 13ms[***m + ❯ lib/services/__tests__/correspondence.service.test.ts ([***m11 tests[***m | [***m2 failed)[***m 52ms[***m + ✓ should call GET /correspondences with params 9ms[***m + ✓ should call GET /correspondences without params 1ms[***m + × should call GET /correspondences/:id 10ms[***m + × should work with string id 4ms[***m + ✓ should call POST /correspondences with data 2ms[***m + ✓ should call PUT /correspondences/:id with data 1ms[***m + ✓ should call DELETE /correspondences/:id 1ms[***m + ✓ should call POST /correspondences/:id/submit 1ms[***m + ✓ should call POST /correspondences/:id/workflow 2ms[***m + ✓ should call POST /correspondences/:id/references 1ms[***m + ✓ should call DELETE /correspondences/:id/references with body 3ms[***m + ❯ hooks/__tests__/use-rfa.test.ts ([***m10 tests[***m | [***m3 failed)[***m 1316ms[***m + ✓ should generate correct cache keys 9ms[***m + ✓ should fetch RFAs successfully 114ms[***m + ✓ should handle error state 61ms[***m + × should fetch single RFA by id 1056ms[***m + ✓ should not fetch when id is falsy 8ms[***m + ✓ should create RFA and show success toast 18ms[***m + ✓ should show error toast on failure 8ms[***m + × should update RFA and invalidate cache 15ms[***m + × should process workflow action and show toast 10ms[***m + ✓ should handle workflow error 9ms[***m + ❯ lib/services/__tests__/project.service.test.ts ([***m7 tests[***m | [***m2 failed)[***m 27ms[***m + ✓ should call GET /projects with params 9ms[***m + ✓ should unwrap paginated response 1ms[***m + × should call GET /projects/:id 7ms[***m + × should work with string id 2ms[***m + ✓ should call POST /projects with data 2ms[***m + ✓ should call PUT /projects/:id with data 1ms[***m + ✓ should call DELETE /projects/:id 1ms[***m + ✓ components/ui/__tests__/button.test.tsx ([***m17 tests[***m)[***m 785ms[***m + ✓[***m should render with default variant and size 389ms[***m +⎯⎯⎯⎯⎯⎯ Failed Tests 17 [***m⎯⎯⎯⎯⎯⎯⎯ + FAIL [***m hooks/__tests__/use-correspondence.test.ts > [***muse-correspondence hooks > [***museCorrespondence > +AssertionError[***m: expected false to be true // Object.is equality +Ignored nodes: comments, script, style + + + +
+ + +- Expected ++ Received +- true ++ false + ❯[***m hooks/__tests__/use-correspondence.test.ts:92:42[***m + 90| + 91| await waitFor(() => { + 92| expect(result.current.isSuccess).toBe(true); + | ^ + 93| }); + 94| + ❯[***m runWithExpensiveErrorDiagnosticsDisabled ../node_modules/.pnpm/@testing-library+dom@10.4.1/node_modules/@testing-library/dom/dist/config.js:47:12[***m + ❯[***m checkCallback ../node_modules/.pnpm/@testing-library+dom@10.4.1/node_modules/@testing-library/dom/dist/wait-for.js:124:77[***m + ❯[***m Timeout.checkRealTimersCallback ../node_modules/.pnpm/@testing-library+dom@10.4.1/node_modules/@testing-library/dom/dist/wait-for.js:118:16[***m +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/17]⎯[***m + FAIL [***m hooks/__tests__/use-correspondence.test.ts > [***muse-correspondence hooks > [***museUpdateCorrespondence > +AssertionError[***m: expected "vi.fn()" to be called with arguments: [ 1, …(1) ] +Received: + 1st vi.fn() call: +[***m [ +- 1, ++ undefined, + { + "subject": "Updated Correspondence", + }, + ] +Number of calls: 1 + ❯[***m hooks/__tests__/use-correspondence.test.ts:181:44[***m + 179| }); + 180| + 181| expect(correspondenceService.update).toHaveBeenCalledWith(1, { + | ^ + 182| subject: 'Updated Correspondence', + 183| }); +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/17]⎯[***m + FAIL [***m hooks/__tests__/use-correspondence.test.ts > [***muse-correspondence hooks > [***museSubmitCorrespondence > +AssertionError[***m: expected "vi.fn()" to be called with arguments: [ 1, { note: 'Ready for review' } ] +Received: + 1st vi.fn() call: +[***m [ +- 1, ++ undefined, + { + "note": "Ready for review", + }, + ] +Number of calls: 1 + ❯[***m hooks/__tests__/use-correspondence.test.ts:219:44[***m + 217| }); + 218| + 219| expect(correspondenceService.submit).toHaveBeenCalledWith(1, { n… + | ^ + ***0| expect(toast.success).toHaveBeenCalledWith('Correspondence submi… + ***1| }); +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[3/17]⎯[***m + FAIL [***m hooks/__tests__/use-correspondence.test.ts > [***muse-correspondence hooks > [***museProcessWorkflow > +AssertionError[***m: expected "vi.fn()" to be called with arguments: [ 1, { action: 'APPROVE', …(1) } ] +Received: + 1st vi.fn() call: +[***m [ +- 1, ++ undefined, + { + "action": "APPROVE", + "comments": "LGTM", + }, + ] +Number of calls: 1 + ❯[***m hooks/__tests__/use-correspondence.test.ts:239:53[***m + 237| }); + 238| + 239| expect(correspondenceService.processWorkflow).toHaveBeenCalledWi… + | ^ + 240| action: 'APPROVE', + 241| comments: 'LGTM', +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[4/17]⎯[***m + FAIL [***m hooks/__tests__/use-drawing.test.ts > [***muse-drawing hooks > [***museDrawings > +AssertionError[***m: expected { …(2) } to deeply equal { …(2) } +- Expected ++ Received +@@ -1,14 +1,18 @@ + { + "data": [ + { +- "drawingNumber": "CD-001", ++ "drawingNumber": undefined, + "id": 1, ++ "type": "CONTRACT", ++ "uuid": 1, + }, + { +- "drawingNumber": "CD-002", ++ "drawingNumber": undefined, + "id": 2, ++ "type": "CONTRACT", ++ "uuid": 2, + }, + ], + "meta": { + "limit": 10, + "page": 1, + ❯[***m hooks/__tests__/use-drawing.test.ts:64:35[***m + 62| }); + 63| + 64| expect(result.current.data).toEqual(mockData); + | ^ + 65| expect(contractDrawingService.getAll).toHaveBeenCalledWith({ pro… + 66| expect(shopDrawingService.getAll).not.toHaveBeenCalled(); +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[5/17]⎯[***m + FAIL [***m hooks/__tests__/use-drawing.test.ts > [***muse-drawing hooks > [***museDrawings > +AssertionError[***m: expected { data: [ { id: 1, …(7) } ], …(1) } to deeply equal { data: [ { id: 1, …(1) } ], …(1) } +- Expected ++ Received +@@ -1,10 +1,16 @@ + { + "data": [ + { ++ "currentRevisionUuid": undefined, + "drawingNumber": "SD-001", + "id": 1, ++ "legacyDrawingNumber": undefined, ++ "revision": undefined, ++ "title": "Untitled", ++ "type": "SHOP", ++ "uuid": 1, + }, + ], + "meta": { + "limit": 10, + "page": 1, + ❯[***m hooks/__tests__/use-drawing.test.ts:84:35[***m + 82| }); + 83| + 84| expect(result.current.data).toEqual(mockData); + | ^ + 85| expect(shopDrawingService.getAll).toHaveBeenCalledWith({ project… + 86| expect(contractDrawingService.getAll).not.toHaveBeenCalled(); +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[6/17]⎯[***m + FAIL [***m hooks/__tests__/use-drawing.test.ts > [***muse-drawing hooks > [***museDrawing > +AssertionError[***m: expected false to be true // Object.is equality +Ignored nodes: comments, script, style + + + +
+ + +- Expected ++ Received +- true ++ false + ❯[***m hooks/__tests__/use-drawing.test.ts:111:42[***m + 109| + 110| await waitFor(() => { + 111| expect(result.current.isSuccess).toBe(true); + | ^ + 112| }); + 113| + ❯[***m runWithExpensiveErrorDiagnosticsDisabled ../node_modules/.pnpm/@testing-library+dom@10.4.1/node_modules/@testing-library/dom/dist/config.js:47:12[***m + ❯[***m checkCallback ../node_modules/.pnpm/@testing-library+dom@10.4.1/node_modules/@testing-library/dom/dist/wait-for.js:124:77[***m + ❯[***m Timeout.checkRealTimersCallback ../node_modules/.pnpm/@testing-library+dom@10.4.1/node_modules/@testing-library/dom/dist/wait-for.js:118:16[***m +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[7/17]⎯[***m + FAIL [***m hooks/__tests__/use-drawing.test.ts > [***muse-drawing hooks > [***museDrawing > +AssertionError[***m: expected false to be true // Object.is equality +Ignored nodes: comments, script, style + + + +
+ + +- Expected ++ Received +- true ++ false + ❯[***m hooks/__tests__/use-drawing.test.ts:126:42[***m + 124| + 125| await waitFor(() => { + 126| expect(result.current.isSuccess).toBe(true); + | ^ + 127| }); + 128| + ❯[***m runWithExpensiveErrorDiagnosticsDisabled ../node_modules/.pnpm/@testing-library+dom@10.4.1/node_modules/@testing-library/dom/dist/config.js:47:12[***m + ❯[***m checkCallback ../node_modules/.pnpm/@testing-library+dom@10.4.1/node_modules/@testing-library/dom/dist/wait-for.js:124:77[***m + ❯[***m Timeout.checkRealTimersCallback ../node_modules/.pnpm/@testing-library+dom@10.4.1/node_modules/@testing-library/dom/dist/wait-for.js:118:16[***m +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[8/17]⎯[***m + FAIL [***m hooks/__tests__/use-projects.test.ts > [***muse-projects hooks > [***museUpdateProject > +AssertionError[***m: expected "vi.fn()" to be called with arguments: [ 1, { name: 'Updated Project' } ] +Received: + 1st vi.fn() call: +[***m [ +- 1, ++ undefined, + { + "name": "Updated Project", + }, + ] +Number of calls: 1 + ❯[***m hooks/__tests__/use-projects.test.ts:144:37[***m + 142| }); + 143| + 144| expect(projectService.update).toHaveBeenCalledWith(1, { name: 'U… + | ^ + 145| expect(toast.success).toHaveBeenCalledWith('Project updated succ… + 146| }); +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[9/17]⎯[***m + FAIL [***m hooks/__tests__/use-rfa.test.ts > [***muse-rfa hooks > [***museRFA > +AssertionError[***m: expected false to be true // Object.is equality +Ignored nodes: comments, script, style + + + +
+ + +- Expected ++ Received +- true ++ false + ❯[***m hooks/__tests__/use-rfa.test.ts:78:42[***m + 76| + 77| await waitFor(() => { + 78| expect(result.current.isSuccess).toBe(true); + | ^ + 79| }); + 80| + ❯[***m runWithExpensiveErrorDiagnosticsDisabled ../node_modules/.pnpm/@testing-library+dom@10.4.1/node_modules/@testing-library/dom/dist/config.js:47:12[***m + ❯[***m checkCallback ../node_modules/.pnpm/@testing-library+dom@10.4.1/node_modules/@testing-library/dom/dist/wait-for.js:124:77[***m + ❯[***m Timeout.checkRealTimersCallback ../node_modules/.pnpm/@testing-library+dom@10.4.1/node_modules/@testing-library/dom/dist/wait-for.js:118:16[***m +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[10/17]⎯[***m + FAIL [***m hooks/__tests__/use-rfa.test.ts > [***muse-rfa hooks > [***museUpdateRFA > +AssertionError[***m: expected "vi.fn()" to be called with arguments: [ 1, { subject: 'Updated RFA' } ] +Received: + 1st vi.fn() call: +[***m [ +- 1, ++ undefined, + { + "subject": "Updated RFA", + }, + ] +Number of calls: 1 + ❯[***m hooks/__tests__/use-rfa.test.ts:159:33[***m + 157| }); + 158| + 159| expect(rfaService.update).toHaveBeenCalledWith(1, { subject: 'Up… + | ^ + 160| expect(toast.success).toHaveBeenCalledWith('RFA updated successf… + 161| }); +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[11/17]⎯[***m + FAIL [***m hooks/__tests__/use-rfa.test.ts > [***muse-rfa hooks > [***museProcessRFA > +AssertionError[***m: expected "vi.fn()" to be called with arguments: [ 1, { action: 'APPROVE', …(1) } ] +Received: + 1st vi.fn() call: +[***m [ +- 1, ++ undefined, + { + "action": "APPROVE", + "comments": "Approved", + }, + ] +Number of calls: 1 + ❯[***m hooks/__tests__/use-rfa.test.ts:179:42[***m + 177| }); + 178| + 179| expect(rfaService.processWorkflow).toHaveBeenCalledWith(1, { + | ^ + 180| action: 'APPROVE', + 181| comments: 'Approved', +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[12/17]⎯[***m + FAIL [***m hooks/__tests__/use-users.test.ts > [***muse-users hooks > [***museUpdateUser > +AssertionError[***m: expected "vi.fn()" to be called with arguments: [ 1, { email: 'updated@example.com' } ] +Received: + 1st vi.fn() call: +[***m [ +- 1, ++ undefined, + { + "email": "updated@example.com", + }, + ] +Number of calls: 1 + ❯[***m hooks/__tests__/use-users.test.ts:154:34[***m + 152| }); + 153| + 154| expect(userService.update).toHaveBeenCalledWith(1, { email: 'upd… + | ^ + 155| expect(toast.success).toHaveBeenCalledWith('User updated success… + 156| }); +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[13/17]⎯[***m + FAIL [***m lib/services/__tests__/correspondence.service.test.ts > [***mcorrespondenceService > [***mgetById > [***mshould call GET /correspondences/:id +TypeError[***m: correspondenceService.getById is not a function + ❯[***m lib/services/__tests__/correspondence.service.test.ts:47:50[***m + 45| vi.mocked(apiClient.get).mockResolvedValue({ data: { data: mockD… + 46| + 47| const result = await correspondenceService.getById(1); + | ^ + 48| + 49| expect(apiClient.get).toHaveBeenCalledWith('/correspondences/1'); +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[14/17]⎯[***m + FAIL [***m lib/services/__tests__/correspondence.service.test.ts > [***mcorrespondenceService > [***mgetById > +TypeError[***m: correspondenceService.getById is not a function + ❯[***m lib/services/__tests__/correspondence.service.test.ts:57:35[***m + 55| vi.mocked(apiClient.get).mockResolvedValue({ data: { data: mockD… + 56| + 57| await correspondenceService.getById('123'); + | ^ + 58| + 59| expect(apiClient.get).toHaveBeenCalledWith('/correspondences/123… +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[15/17]⎯[***m + FAIL [***m lib/services/__tests__/project.service.test.ts > [***mprojectService > [***mgetById > [***mshould call GET /projects/:id +TypeError[***m: projectService.getById is not a function + ❯[***m lib/services/__tests__/project.service.test.ts:42:43[***m + 40| vi.mocked(apiClient.get).mockResolvedValue({ data: mockResponse … + 41| + 42| const result = await projectService.getById(1); + | ^ + 43| + 44| expect(apiClient.get).toHaveBeenCalledWith('/projects/1'); +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[16/17]⎯[***m + FAIL [***m lib/services/__tests__/project.service.test.ts > [***mprojectService > [***mgetById > +TypeError[***m: projectService.getById is not a function + ❯[***m lib/services/__tests__/project.service.test.ts:51:28[***m + 49| vi.mocked(apiClient.get).mockResolvedValue({ data: {} }); + 50| + 51| await projectService.getById('123'); + | ^ + 52| + 53| expect(apiClient.get).toHaveBeenCalledWith('/projects/123'); +⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[17/17]⎯[***m + Test Files [***m 7 failed[***m | [***m2 passed[***m (9) + Tests [***m 17 failed[***m | [***m96 passed[***m (113) + Start at [***m 02:27:55 + Duration [***m 13.91s (transform 1.12s, setup 1.81s, import 3.69s, tests 6.52s, environment 23.02s) +::error file=/workspace/np-dms/lcbp3/frontend/hooks/__tests__/use-correspondence.test.ts,title=hooks/__tests__/use-correspondence.test.ts > use-correspondence hooks > useCorrespondence > should fetch single correspondence by id,line=92,column=42::AssertionError: expected false to be true // Object.is equality%0A%0AIgnored nodes: comments, script, style%0A%0A %0A %0A
%0A %0A%0A%0A- Expected%0A+ Received%0A%0A- true%0A+ false%0A%0A ❯ hooks/__tests__/use-correspondence.test.ts:92:42%0A ❯ runWithExpensiveErrorDiagnosticsDisabled ../node_modules/.pnpm/@testing-library+dom@10.4.1/node_modules/@testing-library/dom/dist/config.js:47:12%0A ❯ checkCallback ../node_modules/.pnpm/@testing-library+dom@10.4.1/node_modules/@testing-library/dom/dist/wait-for.js:124:77%0A ❯ Timeout.checkRealTimersCallback ../node_modules/.pnpm/@testing-library+dom@10.4.1/node_modules/@testing-library/dom/dist/wait-for.js:118:16%0A%0A +::error file=/workspace/np-dms/lcbp3/frontend/hooks/__tests__/use-correspondence.test.ts,title=hooks/__tests__/use-correspondence.test.ts > use-correspondence hooks > useUpdateCorrespondence > should update correspondence and invalidate cache,line=181,column=44::AssertionError: expected "vi.fn()" to be called with arguments: [ 1, …(1) ]%0A%0AReceived:%0A%0A 1st vi.fn() call:%0A%0A [%0A- 1,%0A+ undefined,%0A {%0A "subject": "Updated Correspondence",%0A },%0A ]%0A%0A%0ANumber of calls: 1%0A%0A ❯ hooks/__tests__/use-correspondence.test.ts:181:44%0A%0A +::error file=/workspace/np-dms/lcbp3/frontend/hooks/__tests__/use-correspondence.test.ts,title=hooks/__tests__/use-correspondence.test.ts > use-correspondence hooks > useSubmitCorrespondence > should submit correspondence for workflow,line=219,column=44::AssertionError: expected "vi.fn()" to be called with arguments: [ 1, { note: 'Ready for review' } ]%0A%0AReceived:%0A%0A 1st vi.fn() call:%0A%0A [%0A- 1,%0A+ undefined,%0A {%0A "note": "Ready for review",%0A },%0A ]%0A%0A%0ANumber of calls: 1%0A%0A ❯ hooks/__tests__/use-correspondence.test.ts:219:44%0A%0A +::error file=/workspace/np-dms/lcbp3/frontend/hooks/__tests__/use-correspondence.test.ts,title=hooks/__tests__/use-correspondence.test.ts > use-correspondence hooks > useProcessWorkflow > should process workflow action,line=239,column=53::AssertionError: expected "vi.fn()" to be called with arguments: [ 1, { action: 'APPROVE', …(1) } ]%0A%0AReceived:%0A%0A 1st vi.fn() call:%0A%0A [%0A- 1,%0A+ undefined,%0A {%0A "action": "APPROVE",%0A "comments": "LGTM",%0A },%0A ]%0A%0A%0ANumber of calls: 1%0A%0A ❯ hooks/__tests__/use-correspondence.test.ts:239:53%0A%0A +::error file=/workspace/np-dms/lcbp3/frontend/hooks/__tests__/use-drawing.test.ts,title=hooks/__tests__/use-drawing.test.ts > use-drawing hooks > useDrawings > should fetch CONTRACT drawings successfully,line=64,column=35::AssertionError: expected { …(2) } to deeply equal { …(2) }%0A%0A- Expected%0A+ Received%0A%0A@@ -1,14 +1,18 @@%0A {%0A "data": [%0A {%0A- "drawingNumber": "CD-001",%0A+ "drawingNumber": undefined,%0A "id": 1,%0A+ "type": "CONTRACT",%0A+ "uuid": 1,%0A },%0A {%0A- "drawingNumber": "CD-002",%0A+ "drawingNumber": undefined,%0A "id": 2,%0A+ "type": "CONTRACT",%0A+ "uuid": 2,%0A },%0A ],%0A "meta": {%0A "limit": 10,%0A "page": 1,%0A%0A ❯ hooks/__tests__/use-drawing.test.ts:64:35%0A%0A +::error file=/workspace/np-dms/lcbp3/frontend/hooks/__tests__/use-drawing.test.ts,title=hooks/__tests__/use-drawing.test.ts > use-drawing hooks > useDrawings > should fetch SHOP drawings successfully,line=84,column=35::AssertionError: expected { data: [ { id: 1, …(7) } ], …(1) } to deeply equal { data: [ { id: 1, …(1) } ], …(1) }%0A%0A- Expected%0A+ Received%0A%0A@@ -1,10 +1,16 @@%0A {%0A "data": [%0A {%0A+ "currentRevisionUuid": undefined,%0A "drawingNumber": "SD-001",%0A "id": 1,%0A+ "legacyDrawingNumber": undefined,%0A+ "revision": undefined,%0A+ "title": "Untitled",%0A+ "type": "SHOP",%0A+ "uuid": 1,%0A },%0A ],%0A "meta": {%0A "limit": 10,%0A "page": 1,%0A%0A ❯ hooks/__tests__/use-drawing.test.ts:84:35%0A%0A +::error file=/workspace/np-dms/lcbp3/frontend/hooks/__tests__/use-drawing.test.ts,title=hooks/__tests__/use-drawing.test.ts > use-drawing hooks > useDrawing > should fetch single CONTRACT drawing by id,line=111,column=42::AssertionError: expected false to be true // Object.is equality%0A%0AIgnored nodes: comments, script, style%0A%0A %0A %0A
%0A %0A%0A%0A- Expected%0A+ Received%0A%0A- true%0A+ false%0A%0A ❯ hooks/__tests__/use-drawing.test.ts:111:42%0A ❯ runWithExpensiveErrorDiagnosticsDisabled ../node_modules/.pnpm/@testing-library+dom@10.4.1/node_modules/@testing-library/dom/dist/config.js:47:12%0A ❯ checkCallback ../node_modules/.pnpm/@testing-library+dom@10.4.1/node_modules/@testing-library/dom/dist/wait-for.js:124:77%0A ❯ Timeout.checkRealTimersCallback ../node_modules/.pnpm/@testing-library+dom@10.4.1/node_modules/@testing-library/dom/dist/wait-for.js:118:16%0A%0A +::error file=/workspace/np-dms/lcbp3/frontend/hooks/__tests__/use-drawing.test.ts,title=hooks/__tests__/use-drawing.test.ts > use-drawing hooks > useDrawing > should fetch single SHOP drawing by id,line=126,column=42::AssertionError: expected false to be true // Object.is equality%0A%0AIgnored nodes: comments, script, style%0A%0A %0A %0A
%0A %0A%0A%0A- Expected%0A+ Received%0A%0A- true%0A+ false%0A%0A ❯ hooks/__tests__/use-drawing.test.ts:126:42%0A ❯ runWithExpensiveErrorDiagnosticsDisabled ../node_modules/.pnpm/@testing-library+dom@10.4.1/node_modules/@testing-library/dom/dist/config.js:47:12%0A ❯ checkCallback ../node_modules/.pnpm/@testing-library+dom@10.4.1/node_modules/@testing-library/dom/dist/wait-for.js:124:77%0A ❯ Timeout.checkRealTimersCallback ../node_modules/.pnpm/@testing-library+dom@10.4.1/node_modules/@testing-library/dom/dist/wait-for.js:118:16%0A%0A +::error file=/workspace/np-dms/lcbp3/frontend/hooks/__tests__/use-projects.test.ts,title=hooks/__tests__/use-projects.test.ts > use-projects hooks > useUpdateProject > should update project and show success toast,line=144,column=37::AssertionError: expected "vi.fn()" to be called with arguments: [ 1, { name: 'Updated Project' } ]%0A%0AReceived:%0A%0A 1st vi.fn() call:%0A%0A [%0A- 1,%0A+ undefined,%0A {%0A "name": "Updated Project",%0A },%0A ]%0A%0A%0ANumber of calls: 1%0A%0A ❯ hooks/__tests__/use-projects.test.ts:144:37%0A%0A +::error file=/workspace/np-dms/lcbp3/frontend/hooks/__tests__/use-rfa.test.ts,title=hooks/__tests__/use-rfa.test.ts > use-rfa hooks > useRFA > should fetch single RFA by id,line=78,column=42::AssertionError: expected false to be true // Object.is equality%0A%0AIgnored nodes: comments, script, style%0A%0A %0A %0A
%0A %0A%0A%0A- Expected%0A+ Received%0A%0A- true%0A+ false%0A%0A ❯ hooks/__tests__/use-rfa.test.ts:78:42%0A ❯ runWithExpensiveErrorDiagnosticsDisabled ../node_modules/.pnpm/@testing-library+dom@10.4.1/node_modules/@testing-library/dom/dist/config.js:47:12%0A ❯ checkCallback ../node_modules/.pnpm/@testing-library+dom@10.4.1/node_modules/@testing-library/dom/dist/wait-for.js:124:77%0A ❯ Timeout.checkRealTimersCallback ../node_modules/.pnpm/@testing-library+dom@10.4.1/node_modules/@testing-library/dom/dist/wait-for.js:118:16%0A%0A +::error file=/workspace/np-dms/lcbp3/frontend/hooks/__tests__/use-rfa.test.ts,title=hooks/__tests__/use-rfa.test.ts > use-rfa hooks > useUpdateRFA > should update RFA and invalidate cache,line=159,column=33::AssertionError: expected "vi.fn()" to be called with arguments: [ 1, { subject: 'Updated RFA' } ]%0A%0AReceived:%0A%0A 1st vi.fn() call:%0A%0A [%0A- 1,%0A+ undefined,%0A {%0A "subject": "Updated RFA",%0A },%0A ]%0A%0A%0ANumber of calls: 1%0A%0A ❯ hooks/__tests__/use-rfa.test.ts:159:33%0A%0A +::error file=/workspace/np-dms/lcbp3/frontend/hooks/__tests__/use-rfa.test.ts,title=hooks/__tests__/use-rfa.test.ts > use-rfa hooks > useProcessRFA > should process workflow action and show toast,line=179,column=42::AssertionError: expected "vi.fn()" to be called with arguments: [ 1, { action: 'APPROVE', …(1) } ]%0A%0AReceived:%0A%0A 1st vi.fn() call:%0A%0A [%0A- 1,%0A+ undefined,%0A {%0A "action": "APPROVE",%0A "comments": "Approved",%0A },%0A ]%0A%0A%0ANumber of calls: 1%0A%0A ❯ hooks/__tests__/use-rfa.test.ts:179:42%0A%0A +::error file=/workspace/np-dms/lcbp3/frontend/hooks/__tests__/use-users.test.ts,title=hooks/__tests__/use-users.test.ts > use-users hooks > useUpdateUser > should update user and show success toast,line=154,column=34::AssertionError: expected "vi.fn()" to be called with arguments: [ 1, { email: 'updated@example.com' } ]%0A%0AReceived:%0A%0A 1st vi.fn() call:%0A%0A [%0A- 1,%0A+ undefined,%0A {%0A "email": "updated@example.com",%0A },%0A ]%0A%0A%0ANumber of calls: 1%0A%0A ❯ hooks/__tests__/use-users.test.ts:154:34%0A%0A +::error file=/workspace/np-dms/lcbp3/frontend/lib/services/__tests__/correspondence.service.test.ts,title=lib/services/__tests__/correspondence.service.test.ts > correspondenceService > getById > should call GET /correspondences/%3Aid,line=47,column=50::TypeError: correspondenceService.getById is not a function%0A ❯ lib/services/__tests__/correspondence.service.test.ts:47:50%0A%0A +::error file=/workspace/np-dms/lcbp3/frontend/lib/services/__tests__/correspondence.service.test.ts,title=lib/services/__tests__/correspondence.service.test.ts > correspondenceService > getById > should work with string id,line=57,column=35::TypeError: correspondenceService.getById is not a function%0A ❯ lib/services/__tests__/correspondence.service.test.ts:57:35%0A%0A +::error file=/workspace/np-dms/lcbp3/frontend/lib/services/__tests__/project.service.test.ts,title=lib/services/__tests__/project.service.test.ts > projectService > getById > should call GET /projects/%3Aid,line=42,column=43::TypeError: projectService.getById is not a function%0A ❯ lib/services/__tests__/project.service.test.ts:42:43%0A%0A +::error file=/workspace/np-dms/lcbp3/frontend/lib/services/__tests__/project.service.test.ts,title=lib/services/__tests__/project.service.test.ts > projectService > getById > should work with string id,line=51,column=28::TypeError: projectService.getById is not a function%0A ❯ lib/services/__tests__/project.service.test.ts:51:28%0A%0A  ELIFECYCLE  Test failed. See above for more details. ❌ Failure - Main 🧪 Run Tests exitcode '1': failure +🏗️ Verify Build