| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- 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;
|