Skip to content

Instantly share code, notes, and snippets.

describe('Component', () => {
let wrapper: ReactWrapper;
beforeEach(() => {
// arrange
// mock useEffect function
jest
.spyOn(React, 'useEffect')
.mockImplementation(f => f());
});
var flagtests = []struct {
in string
out string
}{
{"%a", "[%a]"},
{"%-a", "[%-a]"},
{"%+a", "[%+a]"},
{"%#a", "[%#a]"},
{"% a", "[% a]"},
{"%0a", "[%0a]"},
import { getAnimal } from './util';
describe('getAnimal', () => {
context('when passing code 1', () => {
it('should get CATS', () => {
const result = getAnimal(1)
expect(result).toEqual('CATS')
})
})
const cases = [
{
code: 1,
expected: 'CATS',
},
{
code: 2,
expected: 'DOGS',
},
{
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test --env=jsdom",
"eject": "react-scripts eject",
"commit": "git-cz"
},
module.exports = {
extends: [
'react-app',
'plugin:prettier/recommended',
'prettier/react',
],
rules: {
quotes: ['error', 'single'],
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'no-console': process.env.NODE_ENV === 'production' ? 2 : 0,
{
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test --env=jsdom",
"eject": "react-scripts eject",
"commit": "git-cz",
"precommit": "lint-staged" // Added
},
import React from 'react'
import { ThemeProvider } from 'styled-components'
import theme from 'src/styles/theme'
import GlobalStyle from 'src/styles/global'
import Home from 'src/components/Home'
const App: React.FC = (props) => {
return (
<ThemeProvider theme={theme}>
<>
import { css, createGlobalStyle } from 'styled-components'
import ress from 'src/styles/ress'
import { Theme } from 'src/styles/theme'
const global = css<Theme>`
html {
scroll-behavior: smooth;
}
body {
import { primaryColour, textColour, textSubColour } from 'src/styles/variables'
const theme = {
space: [0, 4, 8, 16, 32, 64, 128, 256, 512],
colors: {
primary: primaryColour,
secondary: '',
text: {
primary: textColour,