Skip to content

Commit cd2aa89

Browse files
committed
test: Update tests
1 parent a20336d commit cd2aa89

File tree

92 files changed

+23100
-16306
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+23100
-16306
lines changed

package-lock.json

Lines changed: 16374 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
},
3030
"devDependencies": {
3131
"@babel/core": "^7.15.0",
32+
"@babel/helper-compilation-targets": "^7.15.0",
3233
"@babel/preset-env": "^7.15.0",
3334
"@babel/preset-react": "^7.14.5",
3435
"@coreui/coreui": "^4.0.1",
@@ -48,7 +49,6 @@
4849
"@typescript-eslint/eslint-plugin": "^4.29.1",
4950
"@typescript-eslint/parser": "^4.29.1",
5051
"classnames": "^2.3.1",
51-
"docz": "^2.3.1",
5252
"eslint": "^7.32.0",
5353
"eslint-config-prettier": "^8.3.0",
5454
"eslint-plugin-jsdoc": "^36.0.7",
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import React from 'react'
2+
import { render, screen } from '@testing-library/react'
3+
import '@testing-library/jest-dom/extend-expect'
4+
import { CAccordion } from '../../../index'
5+
6+
test('loads and displays CAccordion component', async () => {
7+
const { container } = render(<CAccordion>Test</CAccordion>)
8+
expect(container).toMatchSnapshot()
9+
})
10+
11+
test('CAccordion customize', async () => {
12+
const { container } = render(<CAccordion className="bazinga">Test</CAccordion>)
13+
expect(container.firstChild).toHaveClass('bazinga')
14+
expect(container).toMatchSnapshot()
15+
})
16+
17+
test('CAccordion use case test', async () => {
18+
jest.useFakeTimers()
19+
const { rerender } = render(<CAccordion flush={false}>Test</CAccordion>)
20+
expect(screen.getByText('Test')).toHaveClass('accordion')
21+
expect(screen.getByText('Test')).not.toHaveClass('accordion-flush')
22+
rerender(<CAccordion flush={true}>Test</CAccordion>)
23+
expect(screen.getByText('Test')).toHaveClass('accordion')
24+
expect(screen.getByText('Test')).toHaveClass('accordion-flush')
25+
jest.runAllTimers()
26+
expect(screen.getByText('Test')).toHaveClass('accordion')
27+
expect(screen.getByText('Test')).toHaveClass('accordion-flush')
28+
rerender(<CAccordion flush={false}>Test</CAccordion>)
29+
expect(screen.getByText('Test')).toHaveClass('accordion')
30+
expect(screen.getByText('Test')).not.toHaveClass('accordion-flush')
31+
jest.runAllTimers()
32+
expect(screen.getByText('Test')).toHaveClass('accordion')
33+
expect(screen.getByText('Test')).not.toHaveClass('accordion-flush')
34+
jest.runAllTimers()
35+
jest.useRealTimers()
36+
})
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React from 'react'
2+
import { render } from '@testing-library/react'
3+
import '@testing-library/jest-dom/extend-expect'
4+
import { CAccordionBody } from '../../../index'
5+
6+
test('loads and displays CAccordionBody component', async () => {
7+
const { container } = render(<CAccordionBody>Test</CAccordionBody>)
8+
expect(container).toMatchSnapshot()
9+
})
10+
11+
test('CAccordionBody customize', async () => {
12+
const { container } = render(<CAccordionBody className="bazinga">Test</CAccordionBody>)
13+
expect(container.firstChild).toHaveClass('bazinga')
14+
expect(container.firstChild).toHaveClass('accordion-body')
15+
expect(container).toMatchSnapshot()
16+
})
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from 'react'
2+
import { render } from '@testing-library/react'
3+
import '@testing-library/jest-dom/extend-expect'
4+
import { CAccordionButton } from '../../../index'
5+
6+
test('loads and displays CAccordionButton component', async () => {
7+
const { container } = render(<CAccordionButton>Test</CAccordionButton>)
8+
expect(container).toMatchSnapshot()
9+
})
10+
11+
test('CAccordionButton customize', async () => {
12+
const { container } = render(<CAccordionButton className="bazinga" collapsed={true}>Test</CAccordionButton>)
13+
expect(container.firstChild).toHaveClass('bazinga')
14+
expect(container.firstChild).toHaveClass('accordion-button')
15+
expect(container.firstChild).toHaveClass('collapsed')
16+
expect(container).toMatchSnapshot()
17+
})
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react'
2+
import { render } from '@testing-library/react'
3+
import '@testing-library/jest-dom/extend-expect'
4+
import { CAccordionCollapse } from '../../../index'
5+
6+
test('loads and displays CAccordionCollapse component', async () => {
7+
const { container } = render(<CAccordionCollapse>Test</CAccordionCollapse>)
8+
expect(container.firstChild).toHaveClass('accordion-collapse')
9+
expect(container).toMatchSnapshot()
10+
})
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React from 'react'
2+
import { render } from '@testing-library/react'
3+
import '@testing-library/jest-dom/extend-expect'
4+
import { CAccordionHeader } from '../../../index'
5+
6+
test('loads and displays CAccordionHeader component', async () => {
7+
const { container } = render(<CAccordionHeader>Test</CAccordionHeader>)
8+
expect(container).toMatchSnapshot()
9+
})
10+
11+
test('CAccordionHeader customize', async () => {
12+
const { container } = render(<CAccordionHeader className="bazinga">Test</CAccordionHeader>)
13+
expect(container.firstChild).toHaveClass('bazinga')
14+
expect(container.firstChild).toHaveClass('accordion-header')
15+
expect(container).toMatchSnapshot()
16+
})
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React from 'react'
2+
import { render } from '@testing-library/react'
3+
import '@testing-library/jest-dom/extend-expect'
4+
import { CAccordionItem } from '../../../index'
5+
6+
test('loads and displays CAccordionItem component', async () => {
7+
const { container } = render(<CAccordionItem>Test</CAccordionItem>)
8+
expect(container).toMatchSnapshot()
9+
})
10+
11+
test('CAccordionItem customize', async () => {
12+
const { container } = render(<CAccordionItem className="bazinga">Test</CAccordionItem>)
13+
expect(container.firstChild).toHaveClass('bazinga')
14+
expect(container.firstChild).toHaveClass('accordion-item')
15+
expect(container).toMatchSnapshot()
16+
})
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`CAccordion customize 1`] = `
4+
<div>
5+
<div
6+
class="accordion bazinga"
7+
>
8+
Test
9+
</div>
10+
</div>
11+
`;
12+
13+
exports[`loads and displays CAccordion component 1`] = `
14+
<div>
15+
<div
16+
class="accordion"
17+
>
18+
Test
19+
</div>
20+
</div>
21+
`;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`CAccordionBody customize 1`] = `
4+
<div>
5+
<div
6+
class="accordion-body bazinga"
7+
>
8+
Test
9+
</div>
10+
</div>
11+
`;
12+
13+
exports[`loads and displays CAccordionBody component 1`] = `
14+
<div>
15+
<div
16+
class="accordion-body"
17+
>
18+
Test
19+
</div>
20+
</div>
21+
`;

0 commit comments

Comments
 (0)