From dac0bfec6c442d0b9eefbf60f22cf3ae50eb751e Mon Sep 17 00:00:00 2001 From: Anton Wilhelm Date: Wed, 20 Feb 2019 21:37:02 +0100 Subject: [PATCH] split test into unit and integration provide some dummy tests cases --- package.json | 2 +- test/fixtures/simple/README.md | 18 ++++++++++++++++++ test/fixtures/simple/other-page.md | 16 ++++++++++++++++ test/integration/render.js | 13 +++++++++++++ test/integration/router.js | 13 +++++++++++++ test/{ => unit}/render.js | 2 +- 6 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 test/fixtures/simple/README.md create mode 100644 test/fixtures/simple/other-page.md create mode 100644 test/integration/render.js create mode 100644 test/integration/router.js rename test/{ => unit}/render.js (97%) diff --git a/package.json b/package.json index 33e6146..c61835b 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "dev": "run-p serve watch:*", "dev:ssr": "run-p serve:ssr watch:*", "lint": "eslint {src,packages} --fix", - "test": "mocha", + "test": "mocha test/*/**", "css": "stylus src/themes/*.styl -u autoprefixer-stylus", "watch:css": "run-p 'css -- -o themes -w'", "watch:js": "node build/build.js", diff --git a/test/fixtures/simple/README.md b/test/fixtures/simple/README.md new file mode 100644 index 0000000..0f3fd46 --- /dev/null +++ b/test/fixtures/simple/README.md @@ -0,0 +1,18 @@ +# Heading + +[another page](other.md) + +## II 1 + +### III 1 + +#### IV 1 + +##### V 1 + + +## II 2 + +### III 2 + +#### IV 2 diff --git a/test/fixtures/simple/other-page.md b/test/fixtures/simple/other-page.md new file mode 100644 index 0000000..4bc6e98 --- /dev/null +++ b/test/fixtures/simple/other-page.md @@ -0,0 +1,16 @@ +# Other + +## two 1 + +### three 1 + +#### four 1 + +##### five 1 + + +## two 2 + +### three 2 + +#### four 2 diff --git a/test/integration/render.js b/test/integration/render.js new file mode 100644 index 0000000..adddfc4 --- /dev/null +++ b/test/integration/render.js @@ -0,0 +1,13 @@ +const path = require('path') + +const {expect} = require('chai') + +const {init, expectSameDom} = require('../_helper') + +describe('full docsify initialization', function() { + it('TODO: check generated markup', async function() { + const {docsify, dom} = await init('simple', {loadSidebar: true}) + console.log(dom.window.document.body.innerHTML) + }) + +}) diff --git a/test/integration/router.js b/test/integration/router.js new file mode 100644 index 0000000..5408683 --- /dev/null +++ b/test/integration/router.js @@ -0,0 +1,13 @@ +const path = require('path') + +const {expect} = require('chai') + +const {init, expectSameDom} = require('../_helper') + +describe('router', function() { + it('TODO: trigger to load another page', async function() { + const {docsify} = await init() + window.location = '/?foo=bar' + }) + +}) diff --git a/test/render.js b/test/unit/render.js similarity index 97% rename from test/render.js rename to test/unit/render.js index a00c1a4..25043cf 100644 --- a/test/render.js +++ b/test/unit/render.js @@ -2,7 +2,7 @@ const path = require('path') const {expect} = require('chai') -const {init, expectSameDom} = require('./_helper') +const {init, expectSameDom} = require('../_helper') describe('render', function() { it('important content (tips)', async function() {