import { mount } from '@vue/test-utils'; import { describe, expect, it } from 'vitest'; import ProductCard from '../app/components/product/ProductCard.vue'; import type { Product } from '../app/composables/useProductCenter'; describe('ProductCard', () => { it('links the entire product card to its Inkpod detail page', () => { const product: Product = { id: '12345', name: '测试商品', priority: 0, image: null, price: '28', country: { id: '1', name: '美国', icon: null }, category: { id: '2', name: 'T恤', icon: null, parentId: null, children: [] }, tag: null, tags: [], }; const wrapper = mount(ProductCard, { props: { product } }); const link = wrapper.get('a.product-card'); expect(link.attributes('href')).toBe('https://inkpod.vip/portal/detail/12345'); expect(link.attributes('target')).toBeUndefined(); }); });