-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Jest testing skeleton and one snapshot test (#613)
- Loading branch information
Showing
10 changed files
with
4,956 additions
and
238 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 @@ | ||
module.exports = "test-file-stub" |
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,26 @@ | ||
const React = require("react") | ||
const gatsby = jest.requireActual("gatsby") | ||
|
||
module.exports = { | ||
...gatsby, | ||
graphql: jest.fn(), | ||
Link: jest.fn().mockImplementation( | ||
({ | ||
activeClassName, | ||
activeStyle, | ||
getProps, | ||
innerRef, | ||
partiallyActive, | ||
ref, | ||
replace, | ||
to, | ||
...rest | ||
}) => | ||
React.createElement("a", { | ||
...rest, | ||
href: to, | ||
}) | ||
), | ||
StaticQuery: jest.fn(), | ||
useStaticQuery: jest.fn(), | ||
} |
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,5 @@ | ||
module.exports = { | ||
useLocaleContext: jest.fn(() => ({ | ||
slug: "", | ||
})), | ||
} |
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,13 @@ | ||
module.exports = { | ||
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`, `<rootDir>.*/public`], | ||
transformIgnorePatterns: [`node_modules/(?!(gatsby)/)`], | ||
globals: { | ||
__PATH_PREFIX__: ``, | ||
}, | ||
testURL: `http://localhost`, | ||
setupFiles: [`<rootDir>/jest/loadershim.js`], | ||
} |
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,3 @@ | ||
global.___loader = { | ||
enqueue: jest.fn(), | ||
} |
Oops, something went wrong.