Skip to content

Commit

Permalink
test: add test for heading and tag component (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
KiruthikaJeyashankar authored Oct 30, 2023
1 parent 8dc3c59 commit 914e736
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/packages/Heading/test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react'
import { render, screen } from '../../utils/testUtils'

import Heading from '.'

describe('<Heading/>', () => {
it('should render the heading', () => {
render(
<Heading>
<span>This is the heading</span>
</Heading>
)

expect(screen.getByText('This is the heading')).toBeInTheDocument()
})
})
18 changes: 18 additions & 0 deletions src/packages/Tag/test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react'
import { render, screen } from '../../utils/testUtils'

import Tag from '.'

describe('<Tag/>', () => {
it('should render the tag value given', () => {
render(<Tag value="coffee" />)

expect(screen.getByText('coffee')).toBeInTheDocument()
})

it('should render tag with uppercase content', async () => {
const dom = render(<Tag value="coffee" isUppercase={true} />)

expect(dom.getByText(/COFFEE/i)).toBeInTheDocument()
})
})

0 comments on commit 914e736

Please sign in to comment.