const router = require('express').Router(); const Mock = require(); const wrapper = require('../wrapper'); const { Random } = Mock; router.post('/create', (req, res) => { res.json(wrapper('success')); }); router.get('/list', (req, res) => { res.json(wrapper( Mock.mock([ { testId: 18, testName: Random.csentence(5, 20), projectId: 45, createTime: Random.datetime(), username: 'ZhaoXR', url: 'https://zhidao.baidu.com/question/1899892881196615220.html', params: [{}], 'method|1': ['get', 'post'], qps: 150, }, { testId: 19, testName: Random.csentence(5, 20), projectId: 45, createTime: Random.datetime(), username: 'ZhaoXR', url: 'http://localhost:3000', params: [{}], 'method|1': ['get', 'post'], qps: 30, }, { testId: 20, testName: Random.csentence(5, 20), projectId: 45, createTime: Random.datetime(), username: 'ZhaoXR', url: 'http://localhost:3000/project/1/apitest', params: [{}], 'method|1': ['get', 'post'], qps: 10, }, { testId: 21, testName: Random.csentence(5, 20), projectId: 45, createTime: Random.datetime(), username: 'ZhaoXR', url: 'localhost:3000', params: [{}], 'method|1': ['get', 'post'], qps: 20, }, ]), )); }); router.get('/delete', (req, res) => { res.json(wrapper('success')); }); router.get('/execute', (req, res) => { res.json(wrapper('success')); }); router.get('/result', (req, res) => { res.json(wrapper( Mock.mock([ { id: 11, testId: 18, executeTime: Random.datetime(), success: 20, failure: 0, timeList: [3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 2, 3, 3, 2, 4, 3, 2, 2, 4, 4], maxTime: 6, minTime: 2, averageTime: 3, pipelineRecordId: -1, }, { id: 12, testId: 18, executeTime: Random.datetime(), success: 20, failure: 0, timeList: [2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 4, 4, 5, 5, 6, 6, 7, 4, 5, 5], maxTime: 7, minTime: 2, averageTime: 4, pipelineRecordId: -1, }, ]), )); }); router.get('/latest', (req, res) => { res.json(wrapper( Mock.mock([ { id: 12, testId: 18, executeTime: Random.datetime(), success: 20, failure: 0, timeList: [2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 4, 4, 5, 5, 6, 6, 7, 4, 5, 5], maxTime: 7, minTime: 2, averageTime: 4, pipelineRecordId: -1, }, ]), )); }); module.exports = router;