import React from 'react' import { render } from '@testing-library/react' import CartPage from '@/pages/cart/index' // Mock Taro相关API jest.mock('@tarojs/taro', () => ({ default: { navigateBack: jest.fn(), navigateTo: jest.fn(), showToast: jest.fn(), showModal: jest.fn(), getStorageSync: jest.fn(), setStorageSync: jest.fn(), }, })) // Mock购物车hook jest.mock('@/utils/cart', () => ({ useCart: () => ({ cart: { items: [ { id: 1, name: '测试商品', price: 29.9, image: 'test-image.jpg', stock: 10, quantity: 2, spec: '红色/M', }, ], totalAmount: 59.8, totalCount: 2, }, updateQuantity: jest.fn(), removeFromCart: jest.fn(), clearCart: jest.fn(), isLoading: false, }), })) // Mock布局组件 jest.mock('@/layouts/tab-bar-layout', () => ({ TabBarLayout: ({ children }: any) =>