html-snapshots 1.3.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -5
- package/.c8rc.json +0 -5
- package/.eslintignore +0 -5
- package/.eslintrc.json +0 -16
- package/.github/issue_template.md +0 -16
- package/.github/workflows/verify.yml +0 -32
- package/docs/example-heroku-redis.md +0 -43
- package/docs/notes.md +0 -42
- package/examples/README.md +0 -149
- package/examples/custom/README.md +0 -22
- package/examples/custom/myFilter.js +0 -22
- package/examples/custom/package-lock.json +0 -2804
- package/examples/custom/package.json +0 -12
- package/examples/custom/snapshot.js +0 -28
- package/examples/debug-phantomjs/README.md +0 -38
- package/examples/debug-phantomjs/package-lock.json +0 -2534
- package/examples/debug-phantomjs/package.json +0 -12
- package/examples/debug-phantomjs/snapshot.js +0 -60
- package/examples/debug-puppeteer/README.md +0 -18
- package/examples/debug-puppeteer/package-lock.json +0 -2804
- package/examples/debug-puppeteer/package.json +0 -12
- package/examples/debug-puppeteer/snapshot.js +0 -30
- package/examples/html5rocks/README.md +0 -22
- package/examples/html5rocks/package-lock.json +0 -3228
- package/examples/html5rocks/package.json +0 -12
- package/examples/html5rocks/snapshot.js +0 -59
- package/examples/process-limit/README.md +0 -24
- package/examples/process-limit/package-lock.json +0 -2830
- package/examples/process-limit/package.json +0 -12
- package/examples/process-limit/snapshot.js +0 -30
- package/examples/simple-promise/README.md +0 -20
- package/examples/simple-promise/package-lock.json +0 -2830
- package/examples/simple-promise/package.json +0 -12
- package/examples/simple-promise/snapshot.js +0 -30
- package/examples/sitemap-index/README.md +0 -20
- package/examples/sitemap-index/package-lock.json +0 -2830
- package/examples/sitemap-index/package.json +0 -12
- package/examples/sitemap-index/snapshot.js +0 -34
- package/examples/verbose/README.md +0 -22
- package/examples/verbose/package-lock.json +0 -2805
- package/examples/verbose/package.json +0 -12
- package/examples/verbose/snapshot.js +0 -34
- package/test/helpers/options.js +0 -55
- package/test/helpers/result.js +0 -32
- package/test/helpers/sitemap.js +0 -130
- package/test/mocha/async/test.js +0 -416
- package/test/mocha/browsers/puppeteer.js +0 -129
- package/test/mocha/browsers/server/index.html +0 -9
- package/test/mocha/browsers/test.js +0 -11
- package/test/mocha/common/helpers.js +0 -87
- package/test/mocha/common/test.js +0 -188
- package/test/mocha/html-snapshots/basics.js +0 -88
- package/test/mocha/html-snapshots/myFilter.js +0 -10
- package/test/mocha/html-snapshots/phantomjs-options.js +0 -156
- package/test/mocha/html-snapshots/process-limit.js +0 -156
- package/test/mocha/html-snapshots/puppeteer.js +0 -47
- package/test/mocha/html-snapshots/robots.js +0 -194
- package/test/mocha/html-snapshots/server/contact/index.html +0 -57
- package/test/mocha/html-snapshots/server/favicon.ico +0 -0
- package/test/mocha/html-snapshots/server/fonts/facebolf-webfont.eot +0 -0
- package/test/mocha/html-snapshots/server/fonts/facebolf-webfont.svg +0 -220
- package/test/mocha/html-snapshots/server/fonts/facebolf-webfont.ttf +0 -0
- package/test/mocha/html-snapshots/server/fonts/facebolf-webfont.woff +0 -0
- package/test/mocha/html-snapshots/server/images/ajax-loader.gif +0 -0
- package/test/mocha/html-snapshots/server/images/art1.jpg +0 -0
- package/test/mocha/html-snapshots/server/images/carpet.jpg +0 -0
- package/test/mocha/html-snapshots/server/images/carpets/carpet1.jpg +0 -0
- package/test/mocha/html-snapshots/server/images/carpets/carpet1_th.jpg +0 -0
- package/test/mocha/html-snapshots/server/images/carpets/carpet2.jpg +0 -0
- package/test/mocha/html-snapshots/server/images/carpets/carpet2_th.jpg +0 -0
- package/test/mocha/html-snapshots/server/images/carpets/carpet3.jpg +0 -0
- package/test/mocha/html-snapshots/server/images/carpets/carpet3_th.jpg +0 -0
- package/test/mocha/html-snapshots/server/images/carpets/carpet4.jpg +0 -0
- package/test/mocha/html-snapshots/server/images/carpets/carpet4_th.jpg +0 -0
- package/test/mocha/html-snapshots/server/images/floor.jpg +0 -0
- package/test/mocha/html-snapshots/server/images/foundation/orbit/bullets.jpg +0 -0
- package/test/mocha/html-snapshots/server/images/foundation/orbit/left-arrow-small.png +0 -0
- package/test/mocha/html-snapshots/server/images/foundation/orbit/left-arrow.png +0 -0
- package/test/mocha/html-snapshots/server/images/foundation/orbit/loading.gif +0 -0
- package/test/mocha/html-snapshots/server/images/foundation/orbit/mask-black.png +0 -0
- package/test/mocha/html-snapshots/server/images/foundation/orbit/pause-black.png +0 -0
- package/test/mocha/html-snapshots/server/images/foundation/orbit/right-arrow-small.png +0 -0
- package/test/mocha/html-snapshots/server/images/foundation/orbit/right-arrow.png +0 -0
- package/test/mocha/html-snapshots/server/images/foundation/orbit/rotator-black.png +0 -0
- package/test/mocha/html-snapshots/server/images/foundation/orbit/timer-black.png +0 -0
- package/test/mocha/html-snapshots/server/images/home-sprite/certification.png +0 -0
- package/test/mocha/html-snapshots/server/images/home-sprite/cleantrust.png +0 -0
- package/test/mocha/html-snapshots/server/images/home-sprite/institute.png +0 -0
- package/test/mocha/html-snapshots/server/images/home-sprite-s1a48fdbd81.png +0 -0
- package/test/mocha/html-snapshots/server/images/logo-300.png +0 -0
- package/test/mocha/html-snapshots/server/images/slider1-lg.jpg +0 -0
- package/test/mocha/html-snapshots/server/images/slider1.jpg +0 -0
- package/test/mocha/html-snapshots/server/index.css +0 -1
- package/test/mocha/html-snapshots/server/index.html +0 -57
- package/test/mocha/html-snapshots/server/nojq/index.html +0 -46
- package/test/mocha/html-snapshots/server/pjsopts/index.html +0 -55
- package/test/mocha/html-snapshots/server/public/page-sitemap.xml +0 -16
- package/test/mocha/html-snapshots/server/public/wordpress/category-sitemap.xml +0 -13
- package/test/mocha/html-snapshots/server/public/wordpress/page-sitemap.xml +0 -16
- package/test/mocha/html-snapshots/server/public/wordpress/post-sitemap.xml +0 -27
- package/test/mocha/html-snapshots/server/public/wordpress/post_tag-sitemap.xml +0 -17
- package/test/mocha/html-snapshots/server/public/wordpress/product-sitemap.xml +0 -13
- package/test/mocha/html-snapshots/server/public/wordpress-2/category-sitemap.xml +0 -13
- package/test/mocha/html-snapshots/server/public/wordpress-2/page-sitemap.xml +0 -16
- package/test/mocha/html-snapshots/server/public/wordpress-2/post-sitemap.xml +0 -27
- package/test/mocha/html-snapshots/server/public/wordpress-2/post_tag-sitemap.xml +0 -17
- package/test/mocha/html-snapshots/server/public/wordpress-2/product-sitemap.xml +0 -13
- package/test/mocha/html-snapshots/server/require.js +0 -1
- package/test/mocha/html-snapshots/server/services/carpets/index.html +0 -57
- package/test/mocha/html-snapshots/server/test_robots.txt +0 -13
- package/test/mocha/html-snapshots/server/test_robots_sitemap.txt +0 -15
- package/test/mocha/html-snapshots/server/test_robots_sitemap.xml +0 -22
- package/test/mocha/html-snapshots/server/test_sitemap_index-2.xml +0 -25
- package/test/mocha/html-snapshots/server/test_sitemap_index-3.xml +0 -25
- package/test/mocha/html-snapshots/server/test_sitemap_index.xml +0 -25
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/extras/custom-validity.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/extras/modernizr-custom.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/extras/mousepress.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/polyfiller.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvas/canvas2png.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvas/flashcanvas.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvas/flashcanvas.swf +0 -0
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvas/proxy.php +0 -73
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvas/save.php +0 -49
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvasPro/canvas2png.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvasPro/flash10canvas.swf +0 -0
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvasPro/flash9canvas.swf +0 -0
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvasPro/flashcanvas.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvasPro/proxy.php +0 -73
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/FlashCanvasPro/save.php +0 -49
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/1.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/10.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/11.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/12.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/13.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/14.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/15.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/16.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/17.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/18.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/19.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/2.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/20.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/21.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/22.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/23.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/24.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/25.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/26.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/27.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/3.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/4.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/5.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/59.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/6.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/7.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/8.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/combos/9.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/details.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/dom-extend.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/es5.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/excanvas.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/form-core.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/form-datalist.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/form-message.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/form-native-extend.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/form-number-date-api.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/form-number-date-ui.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/form-shim-extend.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/geolocation.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-ar.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-ch-ZN.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-de.txt +0 -33
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-el.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-en.txt +0 -34
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-es.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-fr.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-he.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-hi.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-hu.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-it.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-ja.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-nl.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-pt-PT.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-ru.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/i18n/errormessages-sv.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/json-storage.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/jwplayer/license.txt +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/jwplayer/player.swf +0 -0
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/jwplayer/readme.html +0 -87
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/mediaelement-core.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/mediaelement-jaris.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/mediaelement-native-fix.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/mediaelement-swf.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/mediaelement-yt.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/styles/details-arrows.png +0 -0
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/styles/forms.png +0 -0
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/styles/polyfill-loader.gif +0 -0
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/styles/shim.css +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/swf/JarisFLVPlayer.swf +0 -0
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/swf/jwwebshims.swf +0 -0
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/swf/localStorage.swf +0 -0
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/track-ui.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/libs/webshim/minified/shims/track.js +0 -1
- package/test/mocha/html-snapshots/server/vendor/js/plugins/cload.js +0 -49
- package/test/mocha/html-snapshots/server/vendor/js/plugins/modernizr.js +0 -4
- package/test/mocha/html-snapshots/server/vendor/js/plugins/oldie.js +0 -74
- package/test/mocha/html-snapshots/sitemap-index.js +0 -140
- package/test/mocha/html-snapshots/sitemap.js +0 -104
- package/test/mocha/html-snapshots/snapshot-scripts.js +0 -206
- package/test/mocha/html-snapshots/test.js +0 -105
- package/test/mocha/html-snapshots/test_robots.txt +0 -13
- package/test/mocha/html-snapshots/test_sitemap.xml +0 -22
- package/test/mocha/html-snapshots/use-jquery.js +0 -144
- package/test/mocha/html-snapshots/utils.js +0 -200
- package/test/mocha/input-generators/server/public/wordpress/category-sitemap.xml +0 -13
- package/test/mocha/input-generators/server/public/wordpress/page-sitemap.xml +0 -16
- package/test/mocha/input-generators/server/public/wordpress/post-sitemap.xml +0 -55
- package/test/mocha/input-generators/server/public/wordpress/post_tag-sitemap.xml +0 -25
- package/test/mocha/input-generators/server/public/wordpress/product-sitemap.xml +0 -13
- package/test/mocha/input-generators/server/test_robots.txt +0 -15
- package/test/mocha/input-generators/server/test_robots_bad.txt +0 -11
- package/test/mocha/input-generators/server/test_robots_sitemap.txt +0 -17
- package/test/mocha/input-generators/server/test_robots_sitemap_bad.txt +0 -17
- package/test/mocha/input-generators/server/test_robots_sitemap_multi.txt +0 -18
- package/test/mocha/input-generators/server/test_sitemap.xml +0 -34
- package/test/mocha/input-generators/server/test_sitemap.xml.gz +0 -0
- package/test/mocha/input-generators/server/test_sitemap_bad.xml.gz +0 -0
- package/test/mocha/input-generators/server/test_sitemap_index.xml +0 -25
- package/test/mocha/input-generators/server/test_sitemap_index.xml.gz +0 -0
- package/test/mocha/input-generators/server/test_sitemap_index_empty.xml +0 -3
- package/test/mocha/input-generators/server/test_sitemap_index_malformed.xml +0 -2
- package/test/mocha/input-generators/sitemap-index.js +0 -87
- package/test/mocha/input-generators/sitemap.js +0 -320
- package/test/mocha/input-generators/test.js +0 -1447
- package/test/mocha/input-generators/test_line.txt +0 -5
- package/test/mocha/input-generators/test_robots.txt +0 -15
- package/test/mocha/input-generators/test_robots_bad.txt +0 -11
- package/test/mocha/input-generators/test_robots_sitemap.txt +0 -17
- package/test/mocha/input-generators/test_robots_sitemap_bad.txt +0 -17
- package/test/mocha/input-generators/test_robots_sitemap_multi.txt +0 -18
- package/test/mocha/input-generators/test_sitemap.xml +0 -34
- package/test/mocha/input-generators/test_sitemap.xml.gz +0 -0
- package/test/mocha/input-generators/test_sitemap_bad.xml.gz +0 -0
- package/test/mocha/input-generators/test_sitemap_index.xml +0 -25
- package/test/mocha/input-generators/test_sitemap_index.xml.gz +0 -0
- package/test/server/index.js +0 -32
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sitemap-index tests.
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2013 - 2022, Alex Grant, LocalNerve, contributors
|
|
5
|
-
*/
|
|
6
|
-
/* global describe, it, before */
|
|
7
|
-
const assert = require("assert");
|
|
8
|
-
const path = require("path");
|
|
9
|
-
const factory = require("../../../lib/input-generators");
|
|
10
|
-
const server = require("../../server");
|
|
11
|
-
const options = require("../../helpers/options");
|
|
12
|
-
// var smHelper = require("../../helpers/sitemap");
|
|
13
|
-
const port = 9334;
|
|
14
|
-
|
|
15
|
-
describe("input-generator", function () {
|
|
16
|
-
|
|
17
|
-
// NOTE: see main input-generator test suite for the standard coverage tests
|
|
18
|
-
// This is just about specific sitemap index option processing
|
|
19
|
-
|
|
20
|
-
describe("sitemap-index", function () {
|
|
21
|
-
let gen;
|
|
22
|
-
const outputDir = path.join(__dirname, "snapshots");
|
|
23
|
-
|
|
24
|
-
function createOptions (overrideOptions) {
|
|
25
|
-
const basicOptions = {
|
|
26
|
-
input: "sitemap-index",
|
|
27
|
-
outputDirClean: true,
|
|
28
|
-
outputDir,
|
|
29
|
-
port
|
|
30
|
-
};
|
|
31
|
-
return {
|
|
32
|
-
...basicOptions,
|
|
33
|
-
...overrideOptions
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function fail (done, message) {
|
|
38
|
-
const msg = message.toString();
|
|
39
|
-
assert.fail(msg);
|
|
40
|
-
done(new Error(msg));
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
before(function () {
|
|
44
|
-
server.start(path.join(__dirname, "./server"), port);
|
|
45
|
-
gen = factory.create("sitemap-index");
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it("should handle empty sitemap-index", function (done) {
|
|
49
|
-
const source = `http://localhost:${port}/test_sitemap_index_empty.xml`;
|
|
50
|
-
const opts = createOptions({
|
|
51
|
-
source,
|
|
52
|
-
_abort: err => {
|
|
53
|
-
const msg = `empty sitemap-index should not abort, ${err}`;
|
|
54
|
-
fail(done, msg);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
const result = gen.run(options.decorate(opts), () => {
|
|
59
|
-
fail(done, "empty sitemap-index should not produce input");
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
result.then(() => done()).catch(fail.bind(null, done));
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it("should handle malformed sitemap-index", function (done) {
|
|
66
|
-
const source = `http://localhost:${port}/test_sitemap_index_malformed.xml`;
|
|
67
|
-
const opts = createOptions({
|
|
68
|
-
source,
|
|
69
|
-
_abort: err => {
|
|
70
|
-
assert.equal(true, !!err, `${source} should have aborted with error`);
|
|
71
|
-
done();
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
const result = gen.run(
|
|
76
|
-
options.decorate(opts),
|
|
77
|
-
fail.bind(null, done, `Input handler was called unexpectedly for badSource: ${source}`)
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
result.then(() => assert.ok(true)).catch(fail.bind(null, done));
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it("TODO: write specific sitemap-index tests", function () {
|
|
84
|
-
assert.ok(true);
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
});
|
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sitemap tests.
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2013 - 2022, Alex Grant, LocalNerve, contributors
|
|
5
|
-
*/
|
|
6
|
-
/* global describe, it, before */
|
|
7
|
-
var assert = require("assert");
|
|
8
|
-
var path = require("path");
|
|
9
|
-
var rimraf = require("rimraf").sync;
|
|
10
|
-
var factory = require("../../../lib/input-generators");
|
|
11
|
-
var server = require("../../server");
|
|
12
|
-
var options = require("../../helpers/options");
|
|
13
|
-
var smHelper = require("../../helpers/sitemap");
|
|
14
|
-
var port = 9033;
|
|
15
|
-
|
|
16
|
-
describe("input-generator", function () {
|
|
17
|
-
|
|
18
|
-
// NOTE: see main input-generator test suite for the standard coverage tests
|
|
19
|
-
// This is just about specific sitemap option processing
|
|
20
|
-
|
|
21
|
-
describe("sitemap", function () {
|
|
22
|
-
|
|
23
|
-
before(function () {
|
|
24
|
-
server.start(path.join(__dirname, "./server"), port);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
var timeToWait = 300; // milliseconds to wait to record a result
|
|
28
|
-
|
|
29
|
-
var outputDir = path.join(__dirname, "./snapshots");
|
|
30
|
-
var urls = [
|
|
31
|
-
"/",
|
|
32
|
-
"/one",
|
|
33
|
-
"/two",
|
|
34
|
-
"/three",
|
|
35
|
-
"/four/five",
|
|
36
|
-
"/six"
|
|
37
|
-
];
|
|
38
|
-
var sitemapInputGenerators = [
|
|
39
|
-
{
|
|
40
|
-
name: "sitemap-file",
|
|
41
|
-
_testFile: path.join(__dirname, "/server/test_sitemap_dynamic.xml"),
|
|
42
|
-
input: factory.create("sitemap"),
|
|
43
|
-
options: options.decorate({
|
|
44
|
-
source: path.join(__dirname, "/server/test_sitemap_dynamic.xml"),
|
|
45
|
-
sitemapPolicy: true,
|
|
46
|
-
outputDir: outputDir,
|
|
47
|
-
outputDirClean: false
|
|
48
|
-
})
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
name: "sitemap-url",
|
|
52
|
-
_testFile: path.join(__dirname, "/server/test_sitemap_dynamic.xml"),
|
|
53
|
-
input: factory.create("sitemap"),
|
|
54
|
-
options: options.decorate({
|
|
55
|
-
source: "http://localhost:"+port+"/test_sitemap_dynamic.xml",
|
|
56
|
-
sitemapPolicy: true,
|
|
57
|
-
outputDir: outputDir,
|
|
58
|
-
outputDirClean: false
|
|
59
|
-
})
|
|
60
|
-
}
|
|
61
|
-
];
|
|
62
|
-
var lmcfCases = {
|
|
63
|
-
previousNo: [
|
|
64
|
-
{
|
|
65
|
-
// lastmod policy element missing
|
|
66
|
-
// no matter how many are current, they always all get processed
|
|
67
|
-
name: "lastmod",
|
|
68
|
-
missing: smHelper.smElement.lastMod,
|
|
69
|
-
some: {
|
|
70
|
-
current: 2,
|
|
71
|
-
cbLimit: urls.length
|
|
72
|
-
},
|
|
73
|
-
all: {
|
|
74
|
-
current: 0,
|
|
75
|
-
cbLimit: urls.length
|
|
76
|
-
},
|
|
77
|
-
none: {
|
|
78
|
-
current: urls.length,
|
|
79
|
-
cbLimit: urls.length
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
// changefreq policy element missing
|
|
84
|
-
// no matter how many are current, they always all get processed
|
|
85
|
-
name: "changefreq",
|
|
86
|
-
missing: smHelper.smElement.changeFreq,
|
|
87
|
-
some: {
|
|
88
|
-
current: 2,
|
|
89
|
-
cbLimit: urls.length
|
|
90
|
-
},
|
|
91
|
-
all: {
|
|
92
|
-
current: 0,
|
|
93
|
-
cbLimit: urls.length
|
|
94
|
-
},
|
|
95
|
-
none: {
|
|
96
|
-
current: urls.length,
|
|
97
|
-
cbLimit: urls.length
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
],
|
|
101
|
-
previousYes: [
|
|
102
|
-
{
|
|
103
|
-
// lastmod policy element missing
|
|
104
|
-
// should obey meaningful current behavior for some, all, none
|
|
105
|
-
name: "lastmod",
|
|
106
|
-
missing: smHelper.smElement.lastMod,
|
|
107
|
-
some: {
|
|
108
|
-
current: 2,
|
|
109
|
-
cbLimit: urls.length - 2
|
|
110
|
-
},
|
|
111
|
-
all: {
|
|
112
|
-
current: 0,
|
|
113
|
-
cbLimit: urls.length
|
|
114
|
-
},
|
|
115
|
-
none: {
|
|
116
|
-
current: urls.length,
|
|
117
|
-
cbLimit: 0
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
// changefreq policy element missing
|
|
122
|
-
// should obey meaningful current behavior for some, all, none
|
|
123
|
-
name: "changefreq",
|
|
124
|
-
missing: smHelper.smElement.changeFreq,
|
|
125
|
-
some: {
|
|
126
|
-
current: 2,
|
|
127
|
-
cbLimit: urls.length - 2
|
|
128
|
-
},
|
|
129
|
-
all: {
|
|
130
|
-
current: 0,
|
|
131
|
-
cbLimit: urls.length
|
|
132
|
-
},
|
|
133
|
-
none: {
|
|
134
|
-
current: urls.length,
|
|
135
|
-
cbLimit: 0
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
]
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
var baseCases = [
|
|
142
|
-
{
|
|
143
|
-
// all policy elements missing
|
|
144
|
-
// no matter how many are current, they always all get processed
|
|
145
|
-
name: "all",
|
|
146
|
-
missing: smHelper.smElement.all,
|
|
147
|
-
some: {
|
|
148
|
-
current: 2,
|
|
149
|
-
cbLimit: urls.length
|
|
150
|
-
},
|
|
151
|
-
all: {
|
|
152
|
-
current: 0,
|
|
153
|
-
cbLimit: urls.length
|
|
154
|
-
},
|
|
155
|
-
none: {
|
|
156
|
-
current: urls.length,
|
|
157
|
-
cbLimit: urls.length
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
// no policy elements missing
|
|
162
|
-
// current items are not processed
|
|
163
|
-
name: "none",
|
|
164
|
-
missing: smHelper.smElement.none,
|
|
165
|
-
some: {
|
|
166
|
-
current: 2,
|
|
167
|
-
cbLimit: urls.length - 2
|
|
168
|
-
},
|
|
169
|
-
all: {
|
|
170
|
-
current: 0,
|
|
171
|
-
cbLimit: urls.length
|
|
172
|
-
},
|
|
173
|
-
none: {
|
|
174
|
-
current: urls.length,
|
|
175
|
-
cbLimit: 0
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
];
|
|
179
|
-
|
|
180
|
-
// main test cases
|
|
181
|
-
var casesPreviousNo = baseCases.concat(lmcfCases.previousNo);
|
|
182
|
-
var casesPreviousYes = baseCases.concat(lmcfCases.previousYes);
|
|
183
|
-
|
|
184
|
-
// Run a dynamic sitemap input processing test.
|
|
185
|
-
// Make a dynamic sitemap according to spec.
|
|
186
|
-
// After sitemap made, process the input calling the given `inputCallback`.
|
|
187
|
-
// After input processing started, evaluate the result calling `resultCallback`.
|
|
188
|
-
function dynSMIP (gen, urls, current, missing, inputCallback, resultCallback) {
|
|
189
|
-
smHelper.buildSitemapWithPolicy(gen._testFile, urls, current, missing,
|
|
190
|
-
function () {
|
|
191
|
-
resultCallback( gen.input.run(gen.options, inputCallback) );
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
// Create a callback that tests for a truthy result
|
|
196
|
-
function trueResult (limit, done) {
|
|
197
|
-
return function (result) {
|
|
198
|
-
result
|
|
199
|
-
.then(function () {
|
|
200
|
-
assert.ok(true);
|
|
201
|
-
})
|
|
202
|
-
.catch(function (err) {
|
|
203
|
-
assert.fail("run", "fail", err.toString(), "should not");
|
|
204
|
-
})
|
|
205
|
-
if (limit === 0) {
|
|
206
|
-
setTimeout(done, timeToWait);
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// Create a callback counter callback
|
|
212
|
-
// This makes a callback that checks to make sure the number of times
|
|
213
|
-
// it is called back does not exceed the given `limit`. Once that limit
|
|
214
|
-
// is reached, it calls the given `done` callback.
|
|
215
|
-
// In the interim, if it is called more than the limit, it asserts an error.
|
|
216
|
-
function callbackCounter (limit, done) {
|
|
217
|
-
var counter = 0;
|
|
218
|
-
var cb;
|
|
219
|
-
if (limit === 0) {
|
|
220
|
-
cb = function () {
|
|
221
|
-
assert.fail("unexpected", "callback", "input was processed unexpectedly", "function");
|
|
222
|
-
};
|
|
223
|
-
} else {
|
|
224
|
-
cb = function () {
|
|
225
|
-
assert.equal(true, counter++ < limit);
|
|
226
|
-
if (counter === limit) {
|
|
227
|
-
setTimeout(done, timeToWait);
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
return cb;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
sitemapInputGenerators.forEach(function (gen) {
|
|
235
|
-
|
|
236
|
-
describe("policy option true, "+gen.name+",", function () {
|
|
237
|
-
|
|
238
|
-
describe("no previous run output,", function () {
|
|
239
|
-
|
|
240
|
-
before(function () {
|
|
241
|
-
// don't let previous run output interfere
|
|
242
|
-
rimraf(outputDir);
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
casesPreviousNo.forEach(function (testCase) {
|
|
246
|
-
|
|
247
|
-
describe("missing "+testCase.name+",", function () {
|
|
248
|
-
|
|
249
|
-
it("should process some of the expected number of out-of-date urls",
|
|
250
|
-
function (done) {
|
|
251
|
-
dynSMIP(gen, urls, testCase.some.current, testCase.missing,
|
|
252
|
-
callbackCounter(testCase.some.cbLimit, done),
|
|
253
|
-
trueResult(testCase.some.cbLimit, done)
|
|
254
|
-
);
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
it("should process all urls if they're all out-of-date",
|
|
258
|
-
function (done) {
|
|
259
|
-
dynSMIP(gen, urls, testCase.all.current, testCase.missing,
|
|
260
|
-
callbackCounter(testCase.all.cbLimit, done),
|
|
261
|
-
trueResult(testCase.all.cbLimit, done)
|
|
262
|
-
);
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
it("should process none of the urls if they're all up-to-date",
|
|
266
|
-
function (done) {
|
|
267
|
-
dynSMIP(gen, urls, testCase.none.current, testCase.missing,
|
|
268
|
-
callbackCounter(testCase.none.cbLimit, done),
|
|
269
|
-
trueResult(testCase.none.cbLimit, done)
|
|
270
|
-
);
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
});
|
|
274
|
-
});
|
|
275
|
-
});
|
|
276
|
-
|
|
277
|
-
describe("has previous run output,", function () {
|
|
278
|
-
|
|
279
|
-
casesPreviousYes.forEach(function (testCase) {
|
|
280
|
-
|
|
281
|
-
describe("missing "+testCase.name+",", function () {
|
|
282
|
-
|
|
283
|
-
it("should process some of the expected number of out-of-date urls",
|
|
284
|
-
function (done) {
|
|
285
|
-
smHelper.buildTestFiles(gen.options, urls, testCase.some.current);
|
|
286
|
-
|
|
287
|
-
dynSMIP(gen, urls, testCase.some.current, testCase.missing,
|
|
288
|
-
callbackCounter(testCase.some.cbLimit, done),
|
|
289
|
-
trueResult(testCase.some.cbLimit, done)
|
|
290
|
-
);
|
|
291
|
-
});
|
|
292
|
-
|
|
293
|
-
it("should process all urls if they're all out-of-date",
|
|
294
|
-
function (done) {
|
|
295
|
-
smHelper.buildTestFiles(gen.options, urls, testCase.all.current);
|
|
296
|
-
|
|
297
|
-
dynSMIP(gen, urls, testCase.all.current, testCase.missing,
|
|
298
|
-
callbackCounter(testCase.all.cbLimit, done),
|
|
299
|
-
trueResult(testCase.all.cbLimit, done)
|
|
300
|
-
);
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
it("should process none of the urls if they're all up-to-date",
|
|
304
|
-
function (done) {
|
|
305
|
-
smHelper.buildTestFiles(gen.options, urls, testCase.none.current);
|
|
306
|
-
|
|
307
|
-
dynSMIP(gen, urls, testCase.none.current, testCase.missing,
|
|
308
|
-
callbackCounter(testCase.none.cbLimit, done),
|
|
309
|
-
trueResult(testCase.none.cbLimit, done)
|
|
310
|
-
);
|
|
311
|
-
});
|
|
312
|
-
|
|
313
|
-
});
|
|
314
|
-
});
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
});
|
|
318
|
-
});
|
|
319
|
-
});
|
|
320
|
-
});
|