Skip to content

Commit

Permalink
test: add ProductCard test
Browse files Browse the repository at this point in the history
  • Loading branch information
gravitano committed Oct 5, 2023
1 parent 9c247f4 commit 2fa5773
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/nuxt/ProductCard.nuxt.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { describe, expect, it } from 'vitest'
import { mockComponent, mountSuspended } from 'vitest-environment-nuxt/utils'
import ProductCard from '~/components/product/ProductCard.vue'

mockComponent('ProductCard', async () => {
const { h } = await import('vue')
return {
setup() {
return () => h('div', null, 'Mocked')
},
}
})

describe('ProductCard.vue', () => {
it('can mount some component', async () => {
const component = await mountSuspended(ProductCard, {
props: {
title: 'Test title',
description: 'Test description',
category: 'Test category',
image: 'Test image',
},
})

expect(component.text()).toContain('Test title')
expect(component.text()).toContain('Test description')
expect(component.text()).toContain('Test category')
})
})

1 comment on commit 2fa5773

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for morpheme-nuxt-starter ready!

✅ Preview
https://morpheme-nuxt-starter-f77el9plm-gravitano.vercel.app

Built with commit 2fa5773.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.