mirror of
https://github.com/kremalicious/blog.git
synced 2024-12-23 01:30:01 +01:00
test tweaks
This commit is contained in:
parent
273adeecb4
commit
dce40556d2
@ -1,5 +1,5 @@
|
||||
import React, { Suspense } from 'react'
|
||||
import { render, fireEvent, waitForElement } from '@testing-library/react'
|
||||
import { render, fireEvent, waitFor } from '@testing-library/react'
|
||||
|
||||
import Qr from './Qr'
|
||||
|
||||
@ -10,10 +10,8 @@ describe('Qr', () => {
|
||||
<Qr address="xxx" />
|
||||
</Suspense>
|
||||
)
|
||||
const lazyElement = await waitForElement(() =>
|
||||
container.querySelector('button')
|
||||
)
|
||||
expect(lazyElement).toBeInTheDocument()
|
||||
expect(container.firstChild).toBeInTheDocument()
|
||||
await waitFor(() => container.querySelector('button'))
|
||||
fireEvent.click(container.querySelector('button'))
|
||||
})
|
||||
})
|
||||
|
@ -5,7 +5,7 @@ import { PageContext } from '../../@types/Post'
|
||||
import Icon from '../atoms/Icon'
|
||||
import {
|
||||
current as styleCurrent,
|
||||
number,
|
||||
number as styleNumber,
|
||||
pagination
|
||||
} from './Pagination.module.css'
|
||||
|
||||
@ -18,7 +18,7 @@ const PageNumber = ({
|
||||
slug: string
|
||||
current?: boolean
|
||||
}) => {
|
||||
const classes = current ? styleCurrent : number
|
||||
const classes = current ? styleCurrent : styleNumber
|
||||
const link = i === 0 ? slug : `${slug}page/${i + 1}`
|
||||
|
||||
return (
|
||||
@ -40,7 +40,7 @@ function PrevNext({
|
||||
const title = prevPagePath ? 'Newer Posts' : 'Older Posts'
|
||||
|
||||
return (
|
||||
<Link to={link} rel={rel} title={title} className={styles.number}>
|
||||
<Link to={link} rel={rel} title={title} className={styleNumber}>
|
||||
{prevPagePath ? (
|
||||
<Icon name="ChevronLeft" />
|
||||
) : (
|
||||
|
@ -1,13 +1,11 @@
|
||||
import React from 'react'
|
||||
import { render, waitForElement } from '@testing-library/react'
|
||||
import { render, waitFor } from '@testing-library/react'
|
||||
import Thanks from '../thanks'
|
||||
|
||||
describe('/thanks', () => {
|
||||
it('renders without crashing', async () => {
|
||||
const { container } = render(<Thanks />)
|
||||
const lazyElement = await waitForElement(() =>
|
||||
container.querySelector('button')
|
||||
)
|
||||
const lazyElement = await waitFor(() => container.querySelector('button'))
|
||||
expect(lazyElement).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user