mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-07-27 04:32:32 +02:00
refactor(starter): upgrade to new version of gatsby
This commit is contained in:
52
internal/testing/__mocks__/all-markdown-remark.ts
Normal file
52
internal/testing/__mocks__/all-markdown-remark.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
export default {
|
||||
allMarkdownRemark: {
|
||||
group: [
|
||||
{
|
||||
fieldValue: "typography",
|
||||
totalCount: 1,
|
||||
},
|
||||
{
|
||||
fieldValue: "design inspiration",
|
||||
totalCount: 1,
|
||||
},
|
||||
],
|
||||
edges: [
|
||||
{
|
||||
node: {
|
||||
id: "08870ea6-bdc8-4ec6-bf72-1e7d4488eb72",
|
||||
fields: {
|
||||
slug: "/posts/perfecting-the-art-of-perfection",
|
||||
categorySlug: "/typography",
|
||||
},
|
||||
frontmatter: {
|
||||
date: "2016-09-01",
|
||||
description:
|
||||
"An Essay on Typography by Eric Gill takes the reader back to the year 1930. The year when a conflict between two worlds came to its term. The machines of the industrial world finally took over the handicrafts.",
|
||||
category: "typography",
|
||||
title: "Perfecting the Art of Perfection",
|
||||
template: "post",
|
||||
},
|
||||
html: "",
|
||||
},
|
||||
},
|
||||
{
|
||||
node: {
|
||||
id: "066adc91-f87a-4e57-9fef-7a677baf5c1d",
|
||||
fields: {
|
||||
slug: "/posts/the-birth-of-movable-type",
|
||||
categorySlug: "/design-inspiration",
|
||||
},
|
||||
frontmatter: {
|
||||
date: "2016-09-01",
|
||||
description:
|
||||
"German inventor Johannes Gutenberg developed a method of movable type and used it to create one of the western world’s first major printed books, the “Forty–Two–Line” Bible.",
|
||||
category: "design inspiration",
|
||||
title: "Johannes Gutenberg: The Birth of Movable Type",
|
||||
template: "post",
|
||||
},
|
||||
html: "",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
8
internal/testing/__mocks__/author.ts
Normal file
8
internal/testing/__mocks__/author.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import contacts from "./contacts";
|
||||
|
||||
export default {
|
||||
photo: "/static/photo.jpg",
|
||||
bio: "Pellentesque odio nisi, euismod in, pharetra a, ultricies in, diam. Sed arcu.",
|
||||
name: "John Doe",
|
||||
contacts,
|
||||
};
|
8
internal/testing/__mocks__/contacts.ts
Normal file
8
internal/testing/__mocks__/contacts.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export default {
|
||||
rss: "#",
|
||||
email: "#",
|
||||
github: "#",
|
||||
twitter: "#",
|
||||
telegram: "#",
|
||||
vkontakte: "#",
|
||||
};
|
28
internal/testing/__mocks__/gatsby.ts
Normal file
28
internal/testing/__mocks__/gatsby.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import React from "react";
|
||||
|
||||
const gatsby = jest.requireActual("gatsby");
|
||||
|
||||
export default {
|
||||
...gatsby,
|
||||
graphql: jest.fn(),
|
||||
Link: jest
|
||||
.fn()
|
||||
.mockImplementation(
|
||||
({
|
||||
activeClassName,
|
||||
activeStyle,
|
||||
getProps,
|
||||
innerRef,
|
||||
ref,
|
||||
replace,
|
||||
to,
|
||||
...rest
|
||||
}) =>
|
||||
React.createElement("a", {
|
||||
...rest,
|
||||
href: to,
|
||||
}),
|
||||
),
|
||||
StaticQuery: jest.fn(),
|
||||
useStaticQuery: jest.fn(),
|
||||
};
|
7
internal/testing/__mocks__/index.ts
Normal file
7
internal/testing/__mocks__/index.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export { default as allMarkdownRemark } from "./all-markdown-remark";
|
||||
export { default as markdownRemark } from "./markdown-remark";
|
||||
export { default as siteMetadata } from "./site-metadata";
|
||||
export { default as pageContext } from "./page-context";
|
||||
export { default as contacts } from "./contacts";
|
||||
export { default as author } from "./author";
|
||||
export { default as menu } from "./menu";
|
16
internal/testing/__mocks__/markdown-remark.ts
Normal file
16
internal/testing/__mocks__/markdown-remark.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export default {
|
||||
id: "08870ea6-bdc8-4ec6-bf72-1e7d4488eb72",
|
||||
fields: {
|
||||
slug: "/posts/perfecting-the-art-of-perfection",
|
||||
categorySlug: "/typography",
|
||||
},
|
||||
frontmatter: {
|
||||
date: "2016-09-01",
|
||||
description:
|
||||
"An Essay on Typography by Eric Gill takes the reader back to the year 1930. The year when a conflict between two worlds came to its term. The machines of the industrial world finally took over the handicrafts.",
|
||||
category: "typography",
|
||||
title: "Perfecting the Art of Perfection",
|
||||
template: "post",
|
||||
},
|
||||
html: "",
|
||||
};
|
5
internal/testing/__mocks__/menu.ts
Normal file
5
internal/testing/__mocks__/menu.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export default [
|
||||
{ label: "Articles", path: "/" },
|
||||
{ label: "About Me", path: "/pages/about" },
|
||||
{ label: "Contact Me", path: "/pages/contacts" },
|
||||
];
|
12
internal/testing/__mocks__/page-context.ts
Normal file
12
internal/testing/__mocks__/page-context.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
export default {
|
||||
pageContext: {
|
||||
group: "typography",
|
||||
pagination: {
|
||||
currentPage: 2,
|
||||
prevPagePath: "/typography/page/1",
|
||||
nextPagePath: "/typography/page/3",
|
||||
hasNextPage: true,
|
||||
hasPrevPage: true,
|
||||
},
|
||||
},
|
||||
};
|
17
internal/testing/__mocks__/site-metadata.ts
Normal file
17
internal/testing/__mocks__/site-metadata.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import author from "./author";
|
||||
import menu from "./menu";
|
||||
|
||||
export default {
|
||||
site: {
|
||||
siteMetadata: {
|
||||
url: "https://www.lumen.local",
|
||||
title: "Blog by John Doe",
|
||||
subtitle:
|
||||
"Pellentesque odio nisi, euismod in, pharetra a, ultricies in, diam. Sed arcu.",
|
||||
copyright: "All rights reserved.",
|
||||
postsPerPage: 4,
|
||||
author,
|
||||
menu,
|
||||
},
|
||||
},
|
||||
};
|
Reference in New Issue
Block a user