mirror of
https://github.com/kremalicious/portfolio.git
synced 2024-12-22 09:13:19 +01:00
test fixes
This commit is contained in:
parent
80cbfd2cd2
commit
15b5006df4
@ -4,7 +4,7 @@ import posed, { PoseGroup } from 'react-pose'
|
||||
import { fadeIn } from './atoms/Transitions'
|
||||
import Typekit from './atoms/Typekit'
|
||||
import HostnameCheck from './atoms/HostnameCheck'
|
||||
import ThemeSwitch from './molecules/ThemeSwitch'
|
||||
// import ThemeSwitch from './molecules/ThemeSwitch'
|
||||
import Header from './organisms/Header'
|
||||
import Footer from './organisms/Footer'
|
||||
import { screen } from './Layout.module.css'
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import React, { useCallback, useEffect, useState } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import { Helmet } from 'react-helmet'
|
||||
import { hostnameInfo } from './HostnameCheck.module.css'
|
||||
@ -11,16 +11,12 @@ export default function HostnameCheck({ allowedHosts }) {
|
||||
// default to true so SSR builds never show the banner
|
||||
const [isAllowedHost, setIsAllowedHost] = useState(true)
|
||||
|
||||
const checkAllowedHost = () => {
|
||||
if (typeof window !== 'undefined' && window.location) {
|
||||
return allowedHosts.includes(window.location.hostname)
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const isAllowedHost = checkAllowedHost()
|
||||
setIsAllowedHost(isAllowedHost)
|
||||
}, [])
|
||||
if (typeof window !== 'undefined' && window.location) {
|
||||
const isAllowedHost = allowedHosts.includes(window.location.hostname)
|
||||
setIsAllowedHost(isAllowedHost)
|
||||
}
|
||||
}, [allowedHosts])
|
||||
|
||||
return !isAllowedHost ? (
|
||||
<>
|
||||
|
@ -4,7 +4,8 @@ module.exports = {
|
||||
'.+\\.(css|styl|less|sass|scss)$': 'identity-obj-proxy',
|
||||
'.+\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
|
||||
'<rootDir>/tests/__mocks__/file-mock.js',
|
||||
'\\.svg': '<rootDir>/tests/__mocks__/svgr-mock.js'
|
||||
'\\.svg': '<rootDir>/tests/__mocks__/svgr-mock.js',
|
||||
'^@reach/router(.*)': '<rootDir>/node_modules/@gatsbyjs/reach-router$1'
|
||||
},
|
||||
testPathIgnorePatterns: [
|
||||
'node_modules',
|
||||
|
Loading…
Reference in New Issue
Block a user