Skip to content

Commit 1cfdd00

Browse files
mimiflynnkruplm
authored andcommitted
versioned documentation
1 parent 5e8c0c5 commit 1cfdd00

File tree

23 files changed

+13028
-7971
lines changed

23 files changed

+13028
-7971
lines changed

site/__mocks__/documentation.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
module.exports = [
2+
{
3+
id: '2a252835-849d-5e11-9b71-a4a18defc55b',
4+
excerpt:
5+
'Quick Start Install the latest version of Node.js, clone this repo and then:\n\nTo create a build locally:\n\nConfiguration\n\nThis static site…',
6+
frontmatter: {
7+
title: 'Development',
8+
},
9+
internal: {
10+
contentFilePath:
11+
'/Users/mimiflynn/Projects/MS/ms-gh-pages/site/content/documentation/intro-doc.mdx',
12+
},
13+
fields: {
14+
slug: '/documentation/intro-doc/',
15+
},
16+
},
17+
{
18+
id: '9cbc3eec-d3ce-522a-b2fd-197c8407b252',
19+
excerpt:
20+
'This static site generator processes MDX in addition to traditional Markdown files. allows for the use of JSX components within Markdown.…',
21+
frontmatter: {
22+
title: 'Components 2.0',
23+
},
24+
internal: {
25+
contentFilePath:
26+
'/Users/mimiflynn/Projects/MS/ms-gh-pages/site/content/documentation/2.0/components.mdx',
27+
},
28+
fields: {
29+
slug: '/documentation/2.0/components/',
30+
},
31+
},
32+
{
33+
id: '41748935-af24-51c3-8d32-458375e4246c',
34+
excerpt:
35+
'This static site generator processes MDX in addition to traditional Markdown files. allows for the use of JSX components within Markdown.…',
36+
frontmatter: {
37+
title: 'Components',
38+
},
39+
internal: {
40+
contentFilePath:
41+
'/Users/mimiflynn/Projects/MS/ms-gh-pages/site/content/documentation/1.0/components.mdx',
42+
},
43+
fields: {
44+
slug: '/documentation/1.0/components/',
45+
},
46+
},
47+
];

site/__mocks__/file-mock.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// https://www.gatsbyjs.com/docs/how-to/testing/unit-testing/
2+
3+
module.exports = 'test-file-stub';

site/__mocks__/gatsby.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// https://www.gatsbyjs.com/docs/how-to/testing/unit-testing/
2+
3+
const React = require('react');
4+
const gatsby = jest.requireActual('gatsby');
5+
6+
module.exports = {
7+
...gatsby,
8+
graphql: jest.fn(),
9+
Link: jest.fn().mockImplementation(
10+
// these props are invalid for an `a` tag
11+
({
12+
activeClassName,
13+
activeStyle,
14+
getProps,
15+
innerRef,
16+
partiallyActive,
17+
ref,
18+
replace,
19+
to,
20+
...rest
21+
}) =>
22+
React.createElement('a', {
23+
...rest,
24+
href: to,
25+
})
26+
),
27+
Slice: jest.fn().mockImplementation(({ alias, ...rest }) =>
28+
React.createElement('div', {
29+
...rest,
30+
'data-test-slice-alias': alias,
31+
})
32+
),
33+
useStaticQuery: jest.fn(),
34+
};
File renamed without changes.

site/jest.config.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// https://www.gatsbyjs.com/docs/how-to/testing/unit-testing/
2+
3+
module.exports = {
4+
transform: {
5+
'^.+\\.jsx?$': `<rootDir>/tests/jest-preprocess.js`,
6+
},
7+
moduleNameMapper: {
8+
'.+\\.(css|styl|less|sass|scss)$': `identity-obj-proxy`,
9+
'.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': `<rootDir>/__mocks__/file-mock.js`,
10+
},
11+
testPathIgnorePatterns: [`node_modules`, `\\.cache`, `<rootDir>.*/public`],
12+
transformIgnorePatterns: [
13+
`node_modules/(?!(gatsby|gatsby-script|gatsby-link)/)`,
14+
],
15+
globals: {
16+
__PATH_PREFIX__: ``,
17+
},
18+
testEnvironmentOptions: {
19+
url: `http://localhost`,
20+
},
21+
setupFiles: [`<rootDir>/tests/loadershim.js`],
22+
testEnvironment: `jsdom`,
23+
setupFilesAfterEnv: ['<rootDir>/tests/setup-test-env.js'],
24+
};

0 commit comments

Comments
 (0)