Skip to content

Commit

Permalink
Refactor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmonette committed Aug 4, 2018
1 parent 1db9cf4 commit d6a3736
Show file tree
Hide file tree
Showing 10 changed files with 271 additions and 265 deletions.
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
},
testEnvironment: "node",
testPathIgnorePatterns: ["/node_modules/", "__tests__/util/"],
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
testRegex: "(/__tests__/.*\\.spec)\\.(jsx?|tsx?)$",
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
moduleNameMapper: {
"@app/(.*)": "<rootDir>/src/$1"
Expand Down
115 changes: 115 additions & 0 deletions src/__tests__/__snapshots__/atom1.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`atom 1.0 should generate a valid feed - legacy 1`] = `
"<?xml version=\\"1.0\\" encoding=\\"utf-8\\"?>
<feed xmlns=\\"http://www.w3.org/2005/Atom\\">
<id>http://example.com/</id>
<title>Feed Title</title>
<updated>2013-07-13T23:00:00.000Z</updated>
<generator>https://github.com/jpmonette/feed</generator>
<author>
<name>John Doe</name>
<email>johndoe@example.com</email>
<uri>https://example.com/johndoe</uri>
</author>
<link rel=\\"alternate\\" href=\\"http://example.com/\\"/>
<link rel=\\"self\\" href=\\"http://example.com/sampleFeed.rss\\"/>
<subtitle>This is my personnal feed!</subtitle>
<logo>http://example.com/image.png</logo>
<rights>All rights reserved 2013, John Doe</rights>
<category term=\\"Technology\\">
</category>
<contributor>
<name>Johan Cruyff</name>
<email>johancruyff@example.com</email>
<uri>https://example.com/johancruyff</uri>
</contributor>
<entry>
<title type=\\"html\\"><![CDATA[Hello World]]></title>
<id>https://example.com/hello-world</id>
<link href=\\"https://example.com/hello-world\\">
</link>
<updated>2013-07-13T23:00:00.000Z</updated>
<summary type=\\"html\\"><![CDATA[This is an article about Hello World.]]></summary>
<content type=\\"html\\"><![CDATA[Content of my item]]></content>
<author>
<name>Jane Doe</name>
<email>janedoe@example.com</email>
<uri>https://example.com/janedoe</uri>
</author>
<author>
<name>Joe Smith</name>
<email>joesmith@example.com</email>
<uri>https://example.com/joesmith</uri>
</author>
<contributor>
<name>Shawn Kemp</name>
<email>shawnkemp@example.com</email>
<uri>https://example.com/shawnkemp</uri>
</contributor>
<contributor>
<name>Reggie Miller</name>
<email>reggiemiller@example.com</email>
<uri>https://example.com/reggiemiller</uri>
</contributor>
<published>2013-07-10T23:00:00.000Z</published>
</entry>
</feed>"
`;
exports[`atom 1.0 should generate a valid feed 1`] = `
"<?xml version=\\"1.0\\" encoding=\\"utf-8\\"?>
<feed xmlns=\\"http://www.w3.org/2005/Atom\\">
<id>http://example.com/</id>
<title>Feed Title</title>
<updated>2013-07-13T23:00:00.000Z</updated>
<generator>https://github.com/jpmonette/feed</generator>
<author>
<name>John Doe</name>
<email>johndoe@example.com</email>
<uri>https://example.com/johndoe</uri>
</author>
<link rel=\\"alternate\\" href=\\"http://example.com/\\"/>
<link rel=\\"self\\" href=\\"http://example.com/sampleFeed.rss\\"/>
<subtitle>This is my personnal feed!</subtitle>
<logo>http://example.com/image.png</logo>
<rights>All rights reserved 2013, John Doe</rights>
<category term=\\"Technology\\">
</category>
<contributor>
<name>Johan Cruyff</name>
<email>johancruyff@example.com</email>
<uri>https://example.com/johancruyff</uri>
</contributor>
<entry>
<title type=\\"html\\"><![CDATA[Hello World]]></title>
<id>https://example.com/hello-world</id>
<link href=\\"https://example.com/hello-world\\">
</link>
<updated>2013-07-13T23:00:00.000Z</updated>
<summary type=\\"html\\"><![CDATA[This is an article about Hello World.]]></summary>
<content type=\\"html\\"><![CDATA[Content of my item]]></content>
<author>
<name>Jane Doe</name>
<email>janedoe@example.com</email>
<uri>https://example.com/janedoe</uri>
</author>
<author>
<name>Joe Smith</name>
<email>joesmith@example.com</email>
<uri>https://example.com/joesmith</uri>
</author>
<contributor>
<name>Shawn Kemp</name>
<email>shawnkemp@example.com</email>
<uri>https://example.com/shawnkemp</uri>
</contributor>
<contributor>
<name>Reggie Miller</name>
<email>reggiemiller@example.com</email>
<uri>https://example.com/reggiemiller</uri>
</contributor>
<published>2013-07-10T23:00:00.000Z</published>
</entry>
</feed>"
`;
225 changes: 0 additions & 225 deletions src/__tests__/__snapshots__/feed.spec.ts.snap

This file was deleted.

43 changes: 43 additions & 0 deletions src/__tests__/__snapshots__/json.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`json 1 should generate a valid feed 1`] = `
"{
\\"version\\": \\"https://jsonfeed.org/version/1\\",
\\"title\\": \\"Feed Title\\",
\\"home_page_url\\": \\"http://example.com/\\",
\\"description\\": \\"This is my personnal feed!\\",
\\"icon\\": \\"http://example.com/image.png\\",
\\"author\\": {
\\"name\\": \\"John Doe\\",
\\"url\\": \\"https://example.com/johndoe\\"
},
\\"_example_extension\\": {
\\"about\\": \\"just an extension example\\",
\\"dummy\\": \\"example\\"
},
\\"items\\": [
{
\\"id\\": \\"https://example.com/hello-world\\",
\\"html_content\\": \\"Content of my item\\",
\\"url\\": \\"https://example.com/hello-world\\",
\\"title\\": \\"Hello World\\",
\\"summary\\": \\"This is an article about Hello World.\\",
\\"image\\": \\"https://example.com/hello-world.jpg\\",
\\"date_modified\\": \\"2013-07-13T23:00:00.000Z\\",
\\"date_published\\": \\"2013-07-10T23:00:00.000Z\\",
\\"author\\": {
\\"name\\": \\"Jane Doe\\",
\\"url\\": \\"https://example.com/janedoe\\"
},
\\"_item_extension_1\\": {
\\"about\\": \\"just an item extension example\\",
\\"dummy1\\": \\"example\\"
},
\\"_item_extension_2\\": {
\\"about\\": \\"just a second item extension example\\",
\\"dummy1\\": \\"example\\"
}
}
]
}"
`;
Loading

0 comments on commit d6a3736

Please sign in to comment.