From 2e99dc8efec14a53303c8c9e5cc27a07fae81015 Mon Sep 17 00:00:00 2001 From: Katy DeCorah Date: Thu, 17 Oct 2019 13:41:28 -0400 Subject: [PATCH] assert documentation exists when mapboxjs version is bumped in production config --- package.json | 2 +- test/docs.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 test/docs.js diff --git a/package.json b/package.json index d11c07e59..2725035c5 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "sanitize-caja": "0.1.4" }, "scripts": { - "test": "eslint src && phantomjs node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js test/index.html", + "test": "eslint src && phantomjs node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js test/index.html && mocha test/docs.js", "prepublishOnly": "npm run build", "build": "make" }, diff --git a/test/docs.js b/test/docs.js new file mode 100644 index 000000000..5e24eb079 --- /dev/null +++ b/test/docs.js @@ -0,0 +1,15 @@ +// makes sure documentation is generated when `mapboxjs: v#.#.#` is updated in _config.publisher-production.yml +var fs = require('fs'); +var jsyaml = require('js-yaml'); +var assert = require('assert'); + +// get mapbox.js version from config +var config = fs.readFileSync('./_config.publisher-production.yml'); +var yaml = jsyaml.load(config); +var mapboxjs = yaml.mapboxjs; +// assert that that docs/_posts/api/v#.#.# exists +describe('Documentation is generated', function() { + it('Documentation for ' + mapboxjs + ' exists', function() { + assert.equal(fs.existsSync('./docs/_posts/api/' + mapboxjs), true); + }); +});