Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
Switch the integration tests to using snapshots, as they're easier to…
Browse files Browse the repository at this point in the history
… maintain.
  • Loading branch information
pento committed Feb 25, 2021
1 parent 7cfe76c commit 82eb5c5
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 104 deletions.
105 changes: 105 additions & 0 deletions test/integration/wix/__snapshots__/fetch-from-wix-har.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`wix: empty.har -> empty.wxr 1`] = `
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\" ?>
<!-- This is a WordPress eXtended RSS file generated by the \\"Free (as in Speech)\\" browser extension, as an export of your site. -->
<!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
<!-- You may use this file to transfer that content from one site to another. -->
<!-- This file is not intended to serve as a complete backup of your site. -->
<!-- To import this information into a WordPress site follow these steps: -->
<!-- 1. Log in to that site as an administrator. -->
<!-- 2. Go to Tools: Import in the WordPress admin panel. -->
<!-- 3. Install the \\"WordPress\\" importer from the list. -->
<!-- 4. Activate & Run Importer. -->
<!-- 5. Upload this file using the form provided on that page. -->
<!-- 6. You will first be asked to map the authors in this export file to users -->
<!-- on the site. For each author, you may choose to map to an -->
<!-- existing user on the site or to create a new user. -->
<!-- 7. WordPress will then import each of the posts, pages, comments, categories, etc. -->
<!-- contained in this file into your site. -->
<rss version=\\"2.0\\"
xmlns:excerpt=\\"http://wordpress.org/export/1.2/excerpt/\\"
xmlns:content=\\"http://purl.org/rss/1.0/modules/content/\\"
xmlns:wfw=\\"http://wellformedweb.org/CommentAPI/\\"
xmlns:dc=\\"http://purl.org/dc/elements/1.1/\\"
xmlns:wp=\\"http://wordpress.org/export/1.2/\\"
>
<channel>
<pubDate></pubDate>
<wp:wxr_version>1.2</wp:wxr_version>
</channel>
</rss>"
`;

exports[`wix: wix-basic.har -> wix-basic.wxr 1`] = `
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\" ?>
<!-- This is a WordPress eXtended RSS file generated by the \\"Free (as in Speech)\\" browser extension, as an export of your site. -->
<!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
<!-- You may use this file to transfer that content from one site to another. -->
<!-- This file is not intended to serve as a complete backup of your site. -->
<!-- To import this information into a WordPress site follow these steps: -->
<!-- 1. Log in to that site as an administrator. -->
<!-- 2. Go to Tools: Import in the WordPress admin panel. -->
<!-- 3. Install the \\"WordPress\\" importer from the list. -->
<!-- 4. Activate & Run Importer. -->
<!-- 5. Upload this file using the form provided on that page. -->
<!-- 6. You will first be asked to map the authors in this export file to users -->
<!-- on the site. For each author, you may choose to map to an -->
<!-- existing user on the site or to create a new user. -->
<!-- 7. WordPress will then import each of the posts, pages, comments, categories, etc. -->
<!-- contained in this file into your site. -->
<rss version=\\"2.0\\"
xmlns:excerpt=\\"http://wordpress.org/export/1.2/excerpt/\\"
xmlns:content=\\"http://purl.org/rss/1.0/modules/content/\\"
xmlns:wfw=\\"http://wellformedweb.org/CommentAPI/\\"
xmlns:dc=\\"http://purl.org/dc/elements/1.1/\\"
xmlns:wp=\\"http://wordpress.org/export/1.2/\\"
>
<channel>
<title><![CDATA[mywebsite]]></title>
<link><![CDATA[https://12345678.wixsite.com/mywebsite]]></link>
<pubDate></pubDate>
<wp:wxr_version>1.2</wp:wxr_version>
<wp:base_site_url><![CDATA[https://12345678.wixsite.com/mywebsite]]></wp:base_site_url>
<wp:base_blog_url><![CDATA[https://12345678.wixsite.com/mywebsite]]></wp:base_blog_url>
<wp:author>
<wp:author_login><![CDATA[admin]]></wp:author_login>
<wp:author_display_name><![CDATA[]]></wp:author_display_name>
</wp:author>
<item>
<title><![CDATA[Hello World]]></title>
<pubDate><![CDATA[Wed, 27 Jan 2021 08:20:41 GMT]]></pubDate>
<dc:creator><![CDATA[admin]]></dc:creator>
<guid isPermaLink=\\"false\\"><![CDATA[6676d9d6-0318-4dcc-881f-ba6482cff48d]]></guid>
<description></description>
<content:encoded><![CDATA[<!-- wp:paragraph -->
<p>This is my first entry.</p>
<!-- /wp:paragraph -->]]></content:encoded>
<wp:post_date><![CDATA[2021-01-27 08:20:41]]></wp:post_date>
<wp:comment_status><![CDATA[open]]></wp:comment_status>
<wp:status><![CDATA[publish]]></wp:status>
<wp:post_type><![CDATA[post]]></wp:post_type>
<wp:is_sticky>0</wp:is_sticky>
</item>
<item>
<title><![CDATA[Draft]]></title>
<pubDate><![CDATA[]]></pubDate>
<dc:creator><![CDATA[admin]]></dc:creator>
<guid isPermaLink=\\"false\\"><![CDATA[1578305e-fcbe-4767-b656-72d409d27bff]]></guid>
<description></description>
<content:encoded><![CDATA[]]></content:encoded>
<wp:post_date><![CDATA[]]></wp:post_date>
<wp:comment_status><![CDATA[open]]></wp:comment_status>
<wp:status><![CDATA[draft]]></wp:status>
<wp:post_type><![CDATA[post]]></wp:post_type>
<wp:is_sticky>0</wp:is_sticky>
</item>
</channel>
</rss>"
`;
7 changes: 1 addition & 6 deletions test/integration/wix/fetch-from-wix-har.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ test.each( [
[ 'wix-basic.har', 'wix-basic.wxr', false ],
] )( 'wix: %s -> %s', async ( har, wxr, errorsExpected ) => {
const inputHAR = fs.readFileSync( path.join( __dirname, 'fixtures', har ) );
const outputWXR = fs.readFileSync(
path.join( __dirname, 'fixtures', wxr )
);

function stripFirstPubDate( xml ) {
return xml
Expand All @@ -44,9 +41,7 @@ test.each( [
)
.then( ( wxrDriver ) => wxrDriver.export() )
.then( ( xml ) => {
expect( stripFirstPubDate( outputWXR ) ).toEqual(
stripFirstPubDate( xml )
);
expect( stripFirstPubDate( xml ) ).toMatchSnapshot();
if ( errorsExpected ) {
expect( console ).toHaveErrored();
}
Expand Down
31 changes: 0 additions & 31 deletions test/integration/wix/fixtures/empty.wxr

This file was deleted.

67 changes: 0 additions & 67 deletions test/integration/wix/fixtures/wix-basic.wxr

This file was deleted.

0 comments on commit 82eb5c5

Please sign in to comment.