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); + }); +});