1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-12-22 01:03:37 +01:00
This commit is contained in:
Matthias Kretschmann 2022-11-19 21:01:53 +00:00
parent 82ff684a69
commit ca151a6452
Signed by: m
GPG Key ID: 606EEEF3C479A91F
4 changed files with 12 additions and 11 deletions

View File

@ -23,7 +23,9 @@ const esModules = [
'escape-string-regexp',
'markdown-table',
'web-namespaces',
'@rainbow-me/rainbowkit'
'@rainbow-me/rainbowkit',
'wagmi',
'@wagmi/core'
].join('|')
module.exports = {

View File

@ -7,6 +7,8 @@ export const wrapPageElement: GatsbySSR['wrapPageElement'] =
wrapPageElementWithLayout
export const onRenderBody = ({ setPostBodyComponents, setHtmlAttributes }) => {
setHtmlAttributes({ lang: 'en' })
const isEnabled = process.env.NODE_ENV === 'production'
if (!isEnabled) {
@ -18,7 +20,6 @@ export const onRenderBody = ({ setPostBodyComponents, setHtmlAttributes }) => {
'data-website-id': UMAMI_WEBSITE_ID
}
setHtmlAttributes({ lang: 'en' })
setPostBodyComponents([
<script key="umami-script" async defer {...umamiOptions} />
])

View File

@ -21,13 +21,11 @@ export function PureChangelog({
}): ReactElement | null {
const [changelogHtml, setChangelogHtml] = useState()
const repoFilteredArray = repos
const repoMatch = repos
.map(({ node }) => {
if (node.name === repo) return node
})
.filter((n: any) => n)
const repoMatch = repoFilteredArray[0]
.filter((n: any) => n)[0]
useEffect(() => {
if (!(repoMatch?.object as Queries.GitHub_Blob)?.text) return

View File

@ -1,12 +1,12 @@
import React from 'react'
import { render, fireEvent } from '@testing-library/react'
import { render, fireEvent, screen } from '@testing-library/react'
import ThemeSwitch from './ThemeSwitch'
describe('ThemeSwitch', () => {
it('renders correctly', () => {
const { container } = render(<ThemeSwitch />)
const switchContainer = container.querySelector('aside')
expect(switchContainer).toBeInTheDocument()
it('renders correctly', async () => {
render(<ThemeSwitch />)
const element = await screen.findByTitle('Toggle Dark Mode')
expect(element).toBeInTheDocument()
})
it('checkbox can be changed', () => {