mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-07-31 10:11:17 -07:00
Addresses issue #11 items unit testing, snapshot testing. Follows instructions from https://www.gatsbyjs.com/docs/how-to/testing/unit-testing/ ; Adding typescript config, mocks, snapshot capabilities; initial test for j40footer and snapshot, readme update, test helper for intl plugin (#79)
This commit is contained in:
parent
a432a0d8c9
commit
ce7245b1a2
11 changed files with 3633 additions and 27 deletions
4
client/__mocks__/file-mock.js
Normal file
4
client/__mocks__/file-mock.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
/* This was created following along from
|
||||
https://www.gatsbyjs.com/docs/how-to/testing/unit-testing/
|
||||
The purpose is to mock static file imports - see jest.config.js */
|
||||
module.exports = 'test-file-stub';
|
27
client/__mocks__/gatsby.js
Normal file
27
client/__mocks__/gatsby.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
const React = require('react');
|
||||
const gatsby = jest.requireActual('gatsby');
|
||||
|
||||
module.exports = {
|
||||
...gatsby,
|
||||
graphql: jest.fn(),
|
||||
Link: jest.fn().mockImplementation(
|
||||
// these props are invalid for an `a` tag
|
||||
({
|
||||
activeClassName,
|
||||
activeStyle,
|
||||
getProps,
|
||||
innerRef,
|
||||
partiallyActive,
|
||||
ref,
|
||||
replace,
|
||||
to,
|
||||
...rest
|
||||
}) =>
|
||||
React.createElement('a', {
|
||||
...rest,
|
||||
href: to,
|
||||
}),
|
||||
),
|
||||
StaticQuery: jest.fn(),
|
||||
useStaticQuery: jest.fn(),
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue