mirror of
https://github.com/kremalicious/portfolio.git
synced 2024-12-22 09:13:19 +01:00
jest cleanup
This commit is contained in:
parent
7507a4f3ad
commit
2569fc6218
@ -189,7 +189,7 @@ To run all tests, including all linting tests:
|
|||||||
npm test
|
npm test
|
||||||
```
|
```
|
||||||
|
|
||||||
All test files live beside the respective component. Testing setup, fixtures, and mocks can be found in `./jest.config.js` and `./jest` folder.
|
Most test files live beside the respective component. Testing setup, fixtures, and mocks can be found in the `./tests/` folder.
|
||||||
|
|
||||||
### 🎈 Add a new project
|
### 🎈 Add a new project
|
||||||
|
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
const babelOptions = {
|
|
||||||
presets: ['babel-preset-gatsby']
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = require('babel-jest').createTransformer(babelOptions)
|
|
@ -14,8 +14,8 @@
|
|||||||
"lint:css": "stylelint ./src/**/*.{css,scss}",
|
"lint:css": "stylelint ./src/**/*.{css,scss}",
|
||||||
"lint": "npm run lint:js && npm run lint:css",
|
"lint": "npm run lint:js && npm run lint:css",
|
||||||
"format": "prettier --write 'src/**/*.{js,jsx,css,scss}'",
|
"format": "prettier --write 'src/**/*.{js,jsx,css,scss}'",
|
||||||
"test": "npm run lint && jest --coverage --silent",
|
"test": "npm run lint && jest --coverage --silent -c tests/jest.config.js",
|
||||||
"test:watch": "npm run lint && jest --coverage --watch",
|
"test:watch": "npm run lint && jest --coverage --watch -c tests/jest.config.js",
|
||||||
"deploy:s3": "./scripts/deploy-s3.sh",
|
"deploy:s3": "./scripts/deploy-s3.sh",
|
||||||
"new": "babel-node ./scripts/new.js"
|
"new": "babel-node ./scripts/new.js"
|
||||||
},
|
},
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { render, fireEvent, waitForElement } from '@testing-library/react'
|
import { render, fireEvent, waitForElement } from '@testing-library/react'
|
||||||
import Vcard, { constructVcard, toDataURL, init } from './Vcard'
|
import Vcard, { constructVcard, toDataURL, init } from './Vcard'
|
||||||
import meta from '../../../jest/__fixtures__/meta.json'
|
import meta from '../../../tests/__fixtures__/meta.json'
|
||||||
import resume from '../../../jest/__fixtures__/resume.json'
|
import resume from '../../../tests/__fixtures__/resume.json'
|
||||||
|
|
||||||
const metaMock = {
|
const metaMock = {
|
||||||
...meta.metaYaml,
|
...meta.metaYaml,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { render } from '@testing-library/react'
|
import { render } from '@testing-library/react'
|
||||||
import LogoUnit from './LogoUnit'
|
import LogoUnit from './LogoUnit'
|
||||||
import data from '../../../jest/__fixtures__/meta.json'
|
import data from '../../../tests/__fixtures__/meta.json'
|
||||||
|
|
||||||
describe('LogoUnit', () => {
|
describe('LogoUnit', () => {
|
||||||
it('renders correctly from data file values', () => {
|
it('renders correctly from data file values', () => {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { render } from '@testing-library/react'
|
import { render } from '@testing-library/react'
|
||||||
import Repository from './Repository'
|
import Repository from './Repository'
|
||||||
import repos from '../../../jest/__fixtures__/repos.json'
|
import repos from '../../../tests/__fixtures__/repos.json'
|
||||||
|
|
||||||
describe('Repository', () => {
|
describe('Repository', () => {
|
||||||
it('renders correctly', () => {
|
it('renders correctly', () => {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { render } from '@testing-library/react'
|
import { render } from '@testing-library/react'
|
||||||
import Repositories from './Repositories'
|
import Repositories from './Repositories'
|
||||||
import repos from '../../../jest/__fixtures__/repos.json'
|
import repos from '../../../tests/__fixtures__/repos.json'
|
||||||
|
|
||||||
describe('Repositories', () => {
|
describe('Repositories', () => {
|
||||||
it('renders correctly', () => {
|
it('renders correctly', () => {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { render } from '@testing-library/react'
|
import { render } from '@testing-library/react'
|
||||||
import Home from '../index'
|
import Home from '../src/pages/index'
|
||||||
import projects from '../../../jest/__fixtures__/projects.json'
|
import projects from './__fixtures__/projects.json'
|
||||||
import projectImageFiles from '../../../jest/__fixtures__/projectImageFiles.json'
|
import projectImageFiles from './__fixtures__/projectImageFiles.json'
|
||||||
|
|
||||||
describe('Home', () => {
|
describe('Home', () => {
|
||||||
const data = {
|
const data = {
|
@ -1,8 +1,8 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { render } from '@testing-library/react'
|
import { render } from '@testing-library/react'
|
||||||
import { createHistory, createMemorySource } from '@reach/router'
|
import { createHistory, createMemorySource } from '@reach/router'
|
||||||
import Project from '../{ProjectsYaml.slug}'
|
import Project from '../src/pages/{ProjectsYaml.slug}'
|
||||||
import project from '../../../jest/__fixtures__/project.json'
|
import project from './__fixtures__/project.json'
|
||||||
|
|
||||||
describe('Project', () => {
|
describe('Project', () => {
|
||||||
const history = createHistory(createMemorySource('/oceanprotocol'))
|
const history = createHistory(createMemorySource('/oceanprotocol'))
|
@ -1,12 +1,10 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
transform: {
|
rootDir: '../',
|
||||||
'^.+\\.jsx?$': '<rootDir>/jest/jest-preprocess.js'
|
|
||||||
},
|
|
||||||
moduleNameMapper: {
|
moduleNameMapper: {
|
||||||
'.+\\.(css|styl|less|sass|scss)$': 'identity-obj-proxy',
|
'.+\\.(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)$':
|
'.+\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
|
||||||
'<rootDir>/jest/__mocks__/file-mock.js',
|
'<rootDir>/tests/__mocks__/file-mock.js',
|
||||||
'\\.svg': '<rootDir>/jest/__mocks__/svgr-mock.js'
|
'\\.svg': '<rootDir>/tests/__mocks__/svgr-mock.js'
|
||||||
},
|
},
|
||||||
testPathIgnorePatterns: [
|
testPathIgnorePatterns: [
|
||||||
'node_modules',
|
'node_modules',
|
||||||
@ -18,6 +16,6 @@ module.exports = {
|
|||||||
globals: {
|
globals: {
|
||||||
__PATH_PREFIX__: ''
|
__PATH_PREFIX__: ''
|
||||||
},
|
},
|
||||||
setupFiles: ['<rootDir>/jest/loadershim.js'],
|
setupFiles: ['<rootDir>/tests/loadershim.js'],
|
||||||
setupFilesAfterEnv: ['<rootDir>/jest/setup-test-env.js']
|
setupFilesAfterEnv: ['<rootDir>/tests/setup-test-env.js']
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { render } from '@testing-library/react'
|
import { render } from '@testing-library/react'
|
||||||
import Resume from '../resume'
|
import Resume from '../src/pages/resume'
|
||||||
|
|
||||||
describe('Resume', () => {
|
describe('Resume', () => {
|
||||||
it('renders correctly from data file values', () => {
|
it('renders correctly from data file values', () => {
|
Loading…
Reference in New Issue
Block a user