-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #392 from neontribe/testing
Get CI and Linting working again
- Loading branch information
Showing
24 changed files
with
2,183 additions
and
1,283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
language: node_js |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Lets Jest represent imported assets with their filenames | ||
const path = require('path') | ||
|
||
module.exports = { | ||
process(src, filename, config, options) { | ||
return 'module.exports = ' + JSON.stringify(path.basename(filename)) + ';' | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
const babelOptions = { | ||
presets: ['babel-preset-gatsby'], | ||
plugins: ['styled-jsx/babel-test'], | ||
plugins: ['styled-jsx/babel'], | ||
} | ||
|
||
module.exports = require('babel-jest').createTransformer(babelOptions) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
module.exports = { | ||
transform: { | ||
'^.+\\.jsx?$': `<rootDir>/jest-preprocess.js`, | ||
'.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': | ||
'<rootDir>/fileTransformer.js', | ||
}, | ||
moduleNameMapper: { | ||
'.+\\.(css|styl|less|sass|scss)$': `identity-obj-proxy`, | ||
'.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': `<rootDir>/__mocks__/file-mock.js`, | ||
}, | ||
testPathIgnorePatterns: [`node_modules`, `.cache`], | ||
transformIgnorePatterns: [`node_modules/(?!(gatsby)/)`], | ||
globals: { | ||
__PATH_PREFIX__: ``, | ||
}, | ||
testURL: `http://localhost`, | ||
setupFiles: [`<rootDir>/loadershim.js`], | ||
setupFilesAfterEnv: ['<rootDir>/setup-test-env.js'], | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
import 'jest-dom/extend-expect' | ||
|
||
// this is basically: afterEach(cleanup) | ||
import '@testing-library/react/cleanup-after-each' | ||
import '@testing-library/jest-dom' |
This file was deleted.
Oops, something went wrong.
137 changes: 0 additions & 137 deletions
137
src/__tests__/components/FlipCard/__snapshots__/FlipCard.test.js.snap
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from 'react' | ||
import { render, fireEvent } from '@testing-library/react' | ||
|
||
import Carousel from '.' | ||
|
||
const TestCarousel = () => ( | ||
<Carousel> | ||
<Carousel.Item image="a" imageTitle="image 1" /> | ||
<Carousel.Item image="b" imageTitle="image 2" /> | ||
<Carousel.Item image="c" imageTitle="image 3" /> | ||
</Carousel> | ||
) | ||
|
||
test('displays the first item by default', () => { | ||
const { getByTitle } = render(<TestCarousel />) | ||
|
||
expect(getByTitle('image 1')).toBeInTheDocument() | ||
}) | ||
|
||
test('displays second slide after Next is clicked', () => { | ||
const { getByTitle, getByLabelText } = render(<TestCarousel />) | ||
|
||
fireEvent.click(getByLabelText('Next Item')) | ||
|
||
expect(getByTitle('image 2')).toBeInTheDocument() | ||
}) | ||
|
||
test('loops to last item when Previous is clicked', () => { | ||
const { getByTitle, getByLabelText } = render(<TestCarousel />) | ||
|
||
fireEvent.click(getByLabelText('Previous Item')) | ||
|
||
expect(getByTitle('image 3')).toBeInTheDocument() | ||
}) | ||
|
||
test('displays correct item after image is clicked', () => { | ||
const slideNumber = 3 | ||
|
||
const { getByTitle, getByLabelText } = render(<TestCarousel />) | ||
|
||
fireEvent.click(getByLabelText(`Go to item ${slideNumber}`)) | ||
|
||
expect(getByTitle(`image ${slideNumber}`)).toBeInTheDocument() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
4598971
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to following URLs: