From a1b929677696b2223e169f13b3d4cd41b26685b1 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Mon, 15 May 2017 03:15:01 +0430 Subject: [PATCH] [tests] Split modules --- test/fixtures/module/modules/basic/index.js | 21 ++++++------------- .../module/modules/middleware/index.js | 12 +++++++++++ test/fixtures/module/nuxt.config.js | 3 ++- 3 files changed, 20 insertions(+), 16 deletions(-) create mode 100755 test/fixtures/module/modules/middleware/index.js diff --git a/test/fixtures/module/modules/basic/index.js b/test/fixtures/module/modules/basic/index.js index 58e18479b4..675b661201 100755 --- a/test/fixtures/module/modules/basic/index.js +++ b/test/fixtures/module/modules/basic/index.js @@ -1,20 +1,11 @@ const path = require('path') -module.exports = function basicModule (options) { - return new Promise((resolve, reject) => { - // Add simple vendor - this.addVendor('lodash') +module.exports = function basicModule (options, resolve) { + // Add vendor + this.addVendor('lodash') - // Add a plugin - this.addPlugin(path.resolve(__dirname, 'reverse.js')) + // Add a plugin + this.addPlugin(path.resolve(__dirname, 'reverse.js')) - // Add simple api endpoint - this.addServerMiddleware({ - path: '/api', - handler (req, res, next) { - res.end('It works!') - } - }) - resolve() - }) + resolve() } diff --git a/test/fixtures/module/modules/middleware/index.js b/test/fixtures/module/modules/middleware/index.js new file mode 100755 index 0000000000..277e3aaefc --- /dev/null +++ b/test/fixtures/module/modules/middleware/index.js @@ -0,0 +1,12 @@ + +module.exports = function middlewareModule (options) { + return new Promise((resolve, reject) => { + // Add /api endpoint + this.addServerMiddleware({ + path: '/api', + handler (req, res, next) { + res.end('It works!') + } + }) + }) +} diff --git a/test/fixtures/module/nuxt.config.js b/test/fixtures/module/nuxt.config.js index 8c102b63dc..22c1332ca2 100755 --- a/test/fixtures/module/nuxt.config.js +++ b/test/fixtures/module/nuxt.config.js @@ -1,5 +1,6 @@ module.exports = { modules: [ - '~modules/basic' + '~modules/basic', + '~modules/middleware' ] }