Skip to content

Commit

Permalink
test: add test for ContextCard
Browse files Browse the repository at this point in the history
  • Loading branch information
procaconsul committed May 22, 2024
1 parent c0fc035 commit 9c66b4d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/tests/components/ContextCard.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import '@testing-library/jest-dom/extend-expect'
import { render, screen } from '@testing-library/react'
import React from 'react'

import ContextCard from '../../components/ContextCard'

describe('ContextCard', () => {
test('renders the ContextCard component correctly with its heading', () => {
render(<ContextCard text="Test Context" />)

const headingElement = screen.getByRole('heading', { name: /context/i })
expect(headingElement).toBeInTheDocument()
})

test('renders the correct text passed as a prop', () => {
const testText = 'Some text'
render(<ContextCard text={testText} />)

const textElement = screen.getByRole('paragraph')

expect(textElement).toBeInTheDocument()
expect(textElement).toHaveTextContent(testText)
})
})

0 comments on commit 9c66b4d

Please sign in to comment.