Skip to content

Commit

Permalink
test: update unit test;
Browse files Browse the repository at this point in the history
  • Loading branch information
funkyLover committed Jun 28, 2021
1 parent 81df6b7 commit af743a0
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lib/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ const clearCache = require('../clearCache');
const { getStatus, setStatus, resetStaus } = require('./status');
const bodyParserMiddleware = require('koa-bodyparser');
const localMiddleware = require('./local');
const mockMiddleware = require('./mock');
const { mockMiddleware } = require('./mock');
const proxyMiddleware = require('./proxy');

/**
* 获取mock数据, 设置mock数据文件夹监听, 以及调用启动服务器方法启动服务器
* @param {String} mockPath - mock数据存放目录
Expand Down
5 changes: 4 additions & 1 deletion lib/server/mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,7 @@ async function getMockData(api, ctx) {
};
}

module.exports = mockMiddleware;
module.exports = {
getMockConfig: getMockConfig,
mockMiddleware: mockMiddleware
};
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/test.local.ip.request.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const Koa = require('koa');
const axios = require('axios');
const { getStatus, setStatus } = require('../lib/server/status');
const localMiddleware = require('../lib/server/local');
const mockMiddleware = require('../lib/server/mock');
const { mockMiddleware } = require('../lib/server/mock');
const send = require('koa-send');

jest.mock('../lib/server/status');
Expand Down
2 changes: 1 addition & 1 deletion test/test.proxy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const Koa = require('koa');
const axios = require('axios');
const mockMiddleware = require('../lib/server/mock');
const { mockMiddleware } = require('../lib/server/mock');
const proxyMiddleware = require('../lib/server/proxy');
const { getStatus } = require('../lib/server/status');

Expand Down
2 changes: 1 addition & 1 deletion test/test.request.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const Koa = require('koa');
const axios = require('axios');
const mockMiddleware = require('../lib/server/mock');
const { mockMiddleware } = require('../lib/server/mock');
const { getStatus } = require('../lib/server/status');

jest.mock('../lib/server/index');
Expand Down

0 comments on commit af743a0

Please sign in to comment.