diff --git a/app/page.tsx b/app/page.tsx index e8e1d91c..41d85a19 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -15,8 +15,8 @@ import { WorkflowCards } from '@/components/deliveries/WorkflowCards'; import { ValueProps } from '@/components/landing/ValueProps'; import { CallToAction } from '@/components/landing/CallToAction'; import { TrustBar } from '@/components/landing/TrustBar'; -import { PricingCards } from '@/components/pricing/PricingCards'; import { KineticExplorer } from '@/components/landing/KineticExplorer'; +import { PricingCards } from '@/components/pricing/PricingCards'; const solutionFeatures = [ { diff --git a/components/dashboard/ChartSkeletonLoader.tsx b/components/dashboard/ChartSkeletonLoader.tsx index 89f3f6b0..aba51fd1 100644 --- a/components/dashboard/ChartSkeletonLoader.tsx +++ b/components/dashboard/ChartSkeletonLoader.tsx @@ -9,6 +9,8 @@ * - Dark mode support * - Accessible with appropriate ARIA attributes */ +const chartBarHeights = [72, 128, 96, 164, 112, 144, 84, 152, 104, 132, 68, 120]; + export function ChartSkeletonLoader() { return (
@@ -30,14 +32,14 @@ export function ChartSkeletonLoader() {
{/* SVG chart area placeholder */}
- {Array.from({ length: 12 }).map((_, i) => ( + {chartBarHeights.map((height, i) => (
))} diff --git a/components/escrow/__tests__/HighValueCargoMultiSigModal.test.tsx b/components/escrow/__tests__/HighValueCargoMultiSigModal.test.tsx index e7c17128..b4de817c 100644 --- a/components/escrow/__tests__/HighValueCargoMultiSigModal.test.tsx +++ b/components/escrow/__tests__/HighValueCargoMultiSigModal.test.tsx @@ -1,12 +1,11 @@ -import React, { useState } from 'react'; -import { render, screen, within } from '@testing-library/react'; +import { render, screen, waitFor, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; +import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { HighValueCargoMultiSigModal } from '@/components/escrow/HighValueCargoMultiSigModal'; import { - useHighValueCargoApproval, - type UseHighValueCargoApprovalResult, -} from '@/hooks/useHighValueCargoApproval'; -import type { HighValueCargoApproval } from '@/types/highValueCargo'; + highValueCargoService, + HighValueCargoServiceError, +} from '@/services/highValueCargoService'; import { FIXED_NOW, SHIPMENT_ID, @@ -14,68 +13,49 @@ import { domesticApprovalResponse, expiredApprovalResponse, readyApprovalResponse, + submitApprovalResponse, } from '@/hooks/__tests__/fixtures/highValueCargoApiResponses'; -jest.mock('@/hooks/useHighValueCargoApproval', () => ({ - ...jest.requireActual('@/hooks/useHighValueCargoApproval'), - useHighValueCargoApproval: jest.fn(), -})); +jest.mock('@/services/highValueCargoService', () => { + const actual = jest.requireActual('@/services/highValueCargoService'); + return { + ...actual, + highValueCargoService: { getApproval: jest.fn(), submitApproval: jest.fn() }, + }; +}); -const mockUseHighValueCargoApproval = useHighValueCargoApproval as jest.MockedFunction< - typeof useHighValueCargoApproval +const mockGetApproval = highValueCargoService.getApproval as jest.MockedFunction< + typeof highValueCargoService.getApproval +>; +const mockSubmitApproval = highValueCargoService.submitApproval as jest.MockedFunction< + typeof highValueCargoService.submitApproval >; -const REMAINING_MS = (2 * 3600 + 30 * 60 + 15) * 1000; - -function hookStateFor( - approval: HighValueCargoApproval | null, - overrides: Partial = {}, -): UseHighValueCargoApprovalResult { - const approvedCount = approval?.signers.filter((s) => s.status === 'approved').length ?? 0; - const requiredSignatures = approval?.requiredSignatures ?? 0; - const isExpired = approval?.status === 'expired'; - const state: UseHighValueCargoApprovalResult = { - approval, - isLoading: false, - error: null, - refetch: jest.fn(), - approvedCount, - requiredSignatures, - allSignaturesCollected: !!approval && approvedCount >= requiredSignatures, - remainingMs: isExpired ? 0 : REMAINING_MS, - isExpired, - acknowledged: false, - setAcknowledged: jest.fn(), - canSubmit: false, - isSubmitting: false, - submitError: null, - submit: jest.fn(), - ...overrides, - }; - return state; -} - -function renderModal( - state: UseHighValueCargoApprovalResult, - props: Partial> = {}, -) { - mockUseHighValueCargoApproval.mockReturnValue(state); +function renderModal(props: Partial> = {}) { const onClose = jest.fn(); const onSubmitted = jest.fn(); + const queryClient = new QueryClient({ + defaultOptions: { queries: { gcTime: 0, retry: false }, mutations: { retry: false } }, + }); const utils = render( - , + + + , ); - return { ...utils, onClose, onSubmitted, state }; + return { ...utils, onClose, onSubmitted }; } -const submitButton = () => screen.getByRole('button', { name: 'Approve release' }); -const acknowledgement = () => screen.getByRole('checkbox', { name: /i acknowledge/i }); +async function findDialog() { + const dialog = await screen.findByRole('dialog', { name: 'High-value cargo approval' }); + await within(dialog).findByText('Shipment value'); + return dialog; +} describe('HighValueCargoMultiSigModal', () => { beforeEach(() => { diff --git a/components/mobile/MobileFooter.tsx b/components/mobile/MobileFooter.tsx index 567015cc..d042162e 100644 --- a/components/mobile/MobileFooter.tsx +++ b/components/mobile/MobileFooter.tsx @@ -1,7 +1,6 @@ -'use client'; +"use client" -import React from 'react'; -import Link from 'next/link'; +import Link from 'next/link' // Navigation links data const footerLinks = [ diff --git a/components/shared/ErrorFallbackUI.tsx b/components/shared/ErrorFallbackUI.tsx index 624eb7a1..ae612997 100644 --- a/components/shared/ErrorFallbackUI.tsx +++ b/components/shared/ErrorFallbackUI.tsx @@ -117,9 +117,9 @@ export function ErrorFallbackUI({
- {/* Error ID (if available) */} + {/* Error ID */}

- Error ID: {Date.now()} + Error ID: unavailable

diff --git a/features/auth/lib/axios.ts b/features/auth/lib/axios.ts index 3a9fbdde..af5212f2 100644 --- a/features/auth/lib/axios.ts +++ b/features/auth/lib/axios.ts @@ -1,8 +1 @@ -import axios from "axios"; - -const instance = axios.create({ - baseURL: process.env.NEXT_PUBLIC_API_URL, - withCredentials: true, -}); - -export default instance; \ No newline at end of file +export { default } from '@/lib/httpClient'; diff --git a/features/deliveries/components/CancelShipment.tsx b/features/deliveries/components/CancelShipment.tsx index 1b270a17..c7c25fd5 100644 --- a/features/deliveries/components/CancelShipment.tsx +++ b/features/deliveries/components/CancelShipment.tsx @@ -24,6 +24,7 @@ interface CancelShipmentProps { */ export function CancelShipment({ shipmentId }: CancelShipmentProps) { const [isModalOpen, setIsModalOpen] = useState(false); + const modalRef = useRef(null); const { canCancel, @@ -63,8 +64,6 @@ export function CancelShipment({ shipmentId }: CancelShipmentProps) { setIsModalOpen(false); }; - const modalRef = useRef(null); - return (