mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-21 21:16:59 +02:00
chore: do not print prototype in jest snapshot (#6908)
This commit is contained in:
parent
3a4b9b4c30
commit
8c1e518ba2
37 changed files with 1536 additions and 1519 deletions
|
@ -1,7 +1,7 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`atom has feed item for each post 1`] = `
|
||||
Array [
|
||||
[
|
||||
"<?xml version=\\"1.0\\" encoding=\\"utf-8\\"?>
|
||||
<feed xmlns=\\"http://www.w3.org/2005/Atom\\">
|
||||
<id>https://docusaurus.io/myBaseUrl/blog</id>
|
||||
|
@ -85,7 +85,7 @@ Array [
|
|||
`;
|
||||
|
||||
exports[`json has feed item for each post 1`] = `
|
||||
Array [
|
||||
[
|
||||
"{
|
||||
\\"version\\": \\"https://jsonfeed.org/version/1\\",
|
||||
\\"title\\": \\"Hello Blog\\",
|
||||
|
@ -172,7 +172,7 @@ Array [
|
|||
`;
|
||||
|
||||
exports[`rss has feed item for each post 1`] = `
|
||||
Array [
|
||||
[
|
||||
"<?xml version=\\"1.0\\" encoding=\\"utf-8\\"?>
|
||||
<rss version=\\"2.0\\" xmlns:dc=\\"http://purl.org/dc/elements/1.1/\\" xmlns:content=\\"http://purl.org/rss/1.0/modules/content/\\">
|
||||
<channel>
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`blog plugin works on blog tags without pagination 1`] = `
|
||||
Object {
|
||||
"/blog/tags/tag-1": Object {
|
||||
"items": Array [
|
||||
{
|
||||
"/blog/tags/tag-1": {
|
||||
"items": [
|
||||
"/simple/slug/another",
|
||||
"/another/tags",
|
||||
"/another/tags2",
|
||||
],
|
||||
"name": "tag1",
|
||||
"pages": Array [
|
||||
Object {
|
||||
"items": Array [
|
||||
"pages": [
|
||||
{
|
||||
"items": [
|
||||
"/simple/slug/another",
|
||||
"/another/tags",
|
||||
"/another/tags2",
|
||||
],
|
||||
"metadata": Object {
|
||||
"metadata": {
|
||||
"blogDescription": "Blog",
|
||||
"blogTitle": "Blog",
|
||||
"nextPage": null,
|
||||
|
@ -31,19 +31,19 @@ Object {
|
|||
],
|
||||
"permalink": "/blog/tags/tag-1",
|
||||
},
|
||||
"/blog/tags/tag-2": Object {
|
||||
"items": Array [
|
||||
"/blog/tags/tag-2": {
|
||||
"items": [
|
||||
"/another/tags",
|
||||
"/another/tags2",
|
||||
],
|
||||
"name": "tag2",
|
||||
"pages": Array [
|
||||
Object {
|
||||
"items": Array [
|
||||
"pages": [
|
||||
{
|
||||
"items": [
|
||||
"/another/tags",
|
||||
"/another/tags2",
|
||||
],
|
||||
"metadata": Object {
|
||||
"metadata": {
|
||||
"blogDescription": "Blog",
|
||||
"blogTitle": "Blog",
|
||||
"nextPage": null,
|
||||
|
@ -62,21 +62,21 @@ Object {
|
|||
`;
|
||||
|
||||
exports[`blog plugin works with blog tags 1`] = `
|
||||
Object {
|
||||
"/blog/tags/tag-1": Object {
|
||||
"items": Array [
|
||||
{
|
||||
"/blog/tags/tag-1": {
|
||||
"items": [
|
||||
"/simple/slug/another",
|
||||
"/another/tags",
|
||||
"/another/tags2",
|
||||
],
|
||||
"name": "tag1",
|
||||
"pages": Array [
|
||||
Object {
|
||||
"items": Array [
|
||||
"pages": [
|
||||
{
|
||||
"items": [
|
||||
"/simple/slug/another",
|
||||
"/another/tags",
|
||||
],
|
||||
"metadata": Object {
|
||||
"metadata": {
|
||||
"blogDescription": "Blog",
|
||||
"blogTitle": "Blog",
|
||||
"nextPage": "/blog/tags/tag-1/page/2",
|
||||
|
@ -88,11 +88,11 @@ Object {
|
|||
"totalPages": 2,
|
||||
},
|
||||
},
|
||||
Object {
|
||||
"items": Array [
|
||||
{
|
||||
"items": [
|
||||
"/another/tags2",
|
||||
],
|
||||
"metadata": Object {
|
||||
"metadata": {
|
||||
"blogDescription": "Blog",
|
||||
"blogTitle": "Blog",
|
||||
"nextPage": null,
|
||||
|
@ -107,19 +107,19 @@ Object {
|
|||
],
|
||||
"permalink": "/blog/tags/tag-1",
|
||||
},
|
||||
"/blog/tags/tag-2": Object {
|
||||
"items": Array [
|
||||
"/blog/tags/tag-2": {
|
||||
"items": [
|
||||
"/another/tags",
|
||||
"/another/tags2",
|
||||
],
|
||||
"name": "tag2",
|
||||
"pages": Array [
|
||||
Object {
|
||||
"items": Array [
|
||||
"pages": [
|
||||
{
|
||||
"items": [
|
||||
"/another/tags",
|
||||
"/another/tags2",
|
||||
],
|
||||
"metadata": Object {
|
||||
"metadata": {
|
||||
"blogDescription": "Blog",
|
||||
"blogTitle": "Blog",
|
||||
"nextPage": null,
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`getContentTranslationFiles returns translation files matching snapshot 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"content": Object {
|
||||
"description": Object {
|
||||
[
|
||||
{
|
||||
"content": {
|
||||
"description": {
|
||||
"description": "The description for the blog used in SEO",
|
||||
"message": "Someone's random blog",
|
||||
},
|
||||
"sidebar.title": Object {
|
||||
"sidebar.title": {
|
||||
"description": "The label for the left sidebar",
|
||||
"message": "All my posts",
|
||||
},
|
||||
"title": Object {
|
||||
"title": {
|
||||
"description": "The title for the blog used in SEO",
|
||||
"message": "My blog",
|
||||
},
|
||||
|
@ -23,13 +23,13 @@ Array [
|
|||
`;
|
||||
|
||||
exports[`translateContent falls back when translation is incomplete 1`] = `
|
||||
Object {
|
||||
"blogListPaginated": Array [
|
||||
Object {
|
||||
"items": Array [
|
||||
{
|
||||
"blogListPaginated": [
|
||||
{
|
||||
"items": [
|
||||
"hello",
|
||||
],
|
||||
"metadata": Object {
|
||||
"metadata": {
|
||||
"blogDescription": "Someone's random blog",
|
||||
"blogTitle": "My blog",
|
||||
"nextPage": null,
|
||||
|
@ -42,35 +42,35 @@ Object {
|
|||
},
|
||||
},
|
||||
],
|
||||
"blogPosts": Array [
|
||||
Object {
|
||||
"blogPosts": [
|
||||
{
|
||||
"id": "hello",
|
||||
"metadata": Object {
|
||||
"metadata": {
|
||||
"date": 2021-07-19T00:00:00.000Z,
|
||||
"description": "/blog/2021/06/19/hello",
|
||||
"formattedDate": "June 19, 2021",
|
||||
"permalink": "/blog/2021/06/19/hello",
|
||||
"source": "/blog/2021/06/19/hello",
|
||||
"tags": Array [],
|
||||
"tags": [],
|
||||
"title": "Hello",
|
||||
"truncated": true,
|
||||
},
|
||||
},
|
||||
],
|
||||
"blogSidebarTitle": "All my posts",
|
||||
"blogTags": Object {},
|
||||
"blogTags": {},
|
||||
"blogTagsListPath": "/tags",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`translateContent returns translated loaded 1`] = `
|
||||
Object {
|
||||
"blogListPaginated": Array [
|
||||
Object {
|
||||
"items": Array [
|
||||
{
|
||||
"blogListPaginated": [
|
||||
{
|
||||
"items": [
|
||||
"hello",
|
||||
],
|
||||
"metadata": Object {
|
||||
"metadata": {
|
||||
"blogDescription": "Someone's random blog (translated)",
|
||||
"blogTitle": "My blog (translated)",
|
||||
"nextPage": null,
|
||||
|
@ -83,23 +83,23 @@ Object {
|
|||
},
|
||||
},
|
||||
],
|
||||
"blogPosts": Array [
|
||||
Object {
|
||||
"blogPosts": [
|
||||
{
|
||||
"id": "hello",
|
||||
"metadata": Object {
|
||||
"metadata": {
|
||||
"date": 2021-07-19T00:00:00.000Z,
|
||||
"description": "/blog/2021/06/19/hello",
|
||||
"formattedDate": "June 19, 2021",
|
||||
"permalink": "/blog/2021/06/19/hello",
|
||||
"source": "/blog/2021/06/19/hello",
|
||||
"tags": Array [],
|
||||
"tags": [],
|
||||
"title": "Hello",
|
||||
"truncated": true,
|
||||
},
|
||||
},
|
||||
],
|
||||
"blogSidebarTitle": "All my posts (translated)",
|
||||
"blogTags": Object {},
|
||||
"blogTags": {},
|
||||
"blogTagsListPath": "/tags",
|
||||
}
|
||||
`;
|
||||
|
|
|
@ -411,11 +411,14 @@ describe('blog plugin', () => {
|
|||
});
|
||||
|
||||
it('excludes draft blog post from production build', async () => {
|
||||
process.env.NODE_ENV = 'production';
|
||||
const originalEnv = process.env;
|
||||
jest.resetModules();
|
||||
process.env = {...originalEnv, NODE_ENV: 'production'};
|
||||
const siteDir = path.join(__dirname, '__fixtures__', 'website');
|
||||
const blogPosts = await getBlogPosts(siteDir);
|
||||
|
||||
expect(blogPosts.find((v) => v.metadata.title === 'draft')).toBeUndefined();
|
||||
process.env = originalEnv;
|
||||
});
|
||||
|
||||
it('creates blog post without date', async () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue