1
0
mirror of https://github.com/kremalicious/blog.git synced 2025-02-14 21:10:25 +01:00

package updates, fixes for testing-library/react

This commit is contained in:
Matthias Kretschmann 2020-06-08 12:26:34 +02:00
parent 94233d3360
commit 7421b84fa4
Signed by: m
GPG Key ID: 606EEEF3C479A91F
4 changed files with 2285 additions and 461 deletions

2700
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -41,19 +41,19 @@
"fast-exif": "^1.0.1", "fast-exif": "^1.0.1",
"feather-icons": "^4.28.0", "feather-icons": "^4.28.0",
"fraction.js": "^4.0.12", "fraction.js": "^4.0.12",
"gatsby": "^2.22.15", "gatsby": "^2.23.1",
"gatsby-image": "^2.4.5", "gatsby-image": "^2.4.6",
"gatsby-plugin-catch-links": "^2.3.4", "gatsby-plugin-catch-links": "^2.3.4",
"gatsby-plugin-feed": "^2.5.4", "gatsby-plugin-feed": "^2.5.4",
"gatsby-plugin-lunr": "^1.5.2", "gatsby-plugin-lunr": "^1.5.2",
"gatsby-plugin-manifest": "^2.4.9", "gatsby-plugin-manifest": "^2.4.10",
"gatsby-plugin-matomo": "^0.8.3", "gatsby-plugin-matomo": "^0.8.3",
"gatsby-plugin-meta-redirect": "^1.1.1", "gatsby-plugin-meta-redirect": "^1.1.1",
"gatsby-plugin-offline": "^3.2.7", "gatsby-plugin-offline": "^3.2.8",
"gatsby-plugin-react-helmet": "^3.3.2", "gatsby-plugin-react-helmet": "^3.3.3",
"gatsby-plugin-sass": "^2.3.3", "gatsby-plugin-sass": "^2.3.3",
"gatsby-plugin-sharp": "^2.6.10", "gatsby-plugin-sharp": "^2.6.10",
"gatsby-plugin-sitemap": "^2.4.3", "gatsby-plugin-sitemap": "^2.4.4",
"gatsby-plugin-svgr": "^2.0.2", "gatsby-plugin-svgr": "^2.0.2",
"gatsby-plugin-use-dark-mode": "^1.1.2", "gatsby-plugin-use-dark-mode": "^1.1.2",
"gatsby-plugin-webpack-size": "^1.0.0", "gatsby-plugin-webpack-size": "^1.0.0",
@ -63,12 +63,12 @@
"gatsby-remark-copy-linked-files": "^2.3.4", "gatsby-remark-copy-linked-files": "^2.3.4",
"gatsby-remark-images": "^3.3.9", "gatsby-remark-images": "^3.3.9",
"gatsby-remark-images-medium-zoom": "^1.7.0", "gatsby-remark-images-medium-zoom": "^1.7.0",
"gatsby-remark-smartypants": "^2.3.2", "gatsby-remark-smartypants": "^2.3.3",
"gatsby-remark-vscode": "^2.1.2", "gatsby-remark-vscode": "^2.1.2",
"gatsby-source-filesystem": "^2.3.8", "gatsby-source-filesystem": "^2.3.10",
"gatsby-source-graphql": "^2.5.3", "gatsby-source-graphql": "^2.5.3",
"gatsby-transformer-remark": "^2.8.14", "gatsby-transformer-remark": "^2.8.14",
"gatsby-transformer-sharp": "^2.5.3", "gatsby-transformer-sharp": "^2.5.4",
"graphql": "^14.6.0", "graphql": "^14.6.0",
"intersection-observer": "^0.10.0", "intersection-observer": "^0.10.0",
"node-fetch": "^2.6.0", "node-fetch": "^2.6.0",
@ -79,7 +79,7 @@
"react-clipboard.js": "^2.0.16", "react-clipboard.js": "^2.0.16",
"react-dom": "^16.13.1", "react-dom": "^16.13.1",
"react-feather": "^2.0.8", "react-feather": "^2.0.8",
"react-helmet": "^6.0.0", "react-helmet": "^6.1.0",
"react-pose": "^4.0.10", "react-pose": "^4.0.10",
"react-qr-svg": "^2.2.2", "react-qr-svg": "^2.2.2",
"react-transition-group": "^4.4.1", "react-transition-group": "^4.4.1",
@ -93,7 +93,7 @@
"@babel/preset-typescript": "^7.10.1", "@babel/preset-typescript": "^7.10.1",
"@svgr/webpack": "^5.4.0", "@svgr/webpack": "^5.4.0",
"@testing-library/jest-dom": "^5.9.0", "@testing-library/jest-dom": "^5.9.0",
"@testing-library/react": "^10.0.6", "@testing-library/react": "^10.2.1",
"@types/classnames": "^2.2.10", "@types/classnames": "^2.2.10",
"@types/jest": "^25.2.3", "@types/jest": "^25.2.3",
"@types/loadable__component": "^5.10.0", "@types/loadable__component": "^5.10.0",
@ -116,8 +116,8 @@
"eslint-plugin-jsx-a11y": "^6.2.3", "eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.3", "eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-react": "^7.20.0", "eslint-plugin-react": "^7.20.0",
"eslint-plugin-testing-library": "^3.1.4", "eslint-plugin-testing-library": "^3.2.0",
"fs-extra": "^9.0.0", "fs-extra": "^9.0.1",
"gatsby-plugin-webpack-bundle-analyser-v2": "^1.1.10", "gatsby-plugin-webpack-bundle-analyser-v2": "^1.1.10",
"identity-obj-proxy": "^3.0.0", "identity-obj-proxy": "^3.0.0",
"jest": "^26.0.1", "jest": "^26.0.1",
@ -133,7 +133,7 @@
"stylelint-config-prettier": "^8.0.1", "stylelint-config-prettier": "^8.0.1",
"stylelint-config-standard": "^20.0.0", "stylelint-config-standard": "^20.0.0",
"stylelint-prettier": "^1.1.2", "stylelint-prettier": "^1.1.2",
"typescript": "^3.9.3" "typescript": "^3.9.5"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -1,12 +1,12 @@
import React from 'react' import React from 'react'
import { render, waitForElement } from '@testing-library/react' import { render } from '@testing-library/react'
import Conversion from './Conversion' import Conversion from './Conversion'
describe('Conversion', () => { describe('Conversion', () => {
it('renders without crashing', async () => { it('renders without crashing', async () => {
const { getByText } = render(<Conversion amount={1} />) const { findByText } = render(<Conversion amount={1} />)
const lazyElement = await waitForElement(() => getByText(/= €/)) const lazyElement = await findByText(/= €/)
expect(lazyElement).toBeInTheDocument() expect(lazyElement).toBeInTheDocument()
}) })
}) })

View File

@ -1,5 +1,5 @@
import React from 'react' import React from 'react'
import { render, waitForElement, fireEvent } from '@testing-library/react' import { render, waitFor, fireEvent } from '@testing-library/react'
import { Web3ReactProvider } from '@web3-react/core' import { Web3ReactProvider } from '@web3-react/core'
import { getLibrary } from '../../../hooks/use-web3' import { getLibrary } from '../../../hooks/use-web3'
@ -7,20 +7,16 @@ import Web3Donation from '.'
describe('Web3Donation', () => { describe('Web3Donation', () => {
it('renders without crashing', async () => { it('renders without crashing', async () => {
const { container, getByText } = render( const { container, findByText } = render(
<Web3ReactProvider getLibrary={getLibrary}> <Web3ReactProvider getLibrary={getLibrary}>
<Web3Donation address="xxx" /> <Web3Donation address="xxx" />
</Web3ReactProvider> </Web3ReactProvider>
) )
const lazyElement = await waitForElement(() => const lazyElement = await waitFor(() => container.querySelector('button'))
container.querySelector('button')
)
expect(lazyElement).toBeInTheDocument() expect(lazyElement).toBeInTheDocument()
fireEvent.click(lazyElement) fireEvent.click(lazyElement)
const message = await waitForElement(() => const message = await findByText(/No Ethereum browser extension detected/)
getByText(/No Ethereum browser extension detected/)
)
expect(message).toBeInTheDocument() expect(message).toBeInTheDocument()
}) })
}) })