const makeId = require("../../util/makeId"); const dayjs = require("dayjs"); /** * @description 代码作业一次功能测试的基本信息 * @typedef {Object} FunctionalTestSerializerType * @property {number} id 代码作业一次功能测试的 id * @property {number} time 测试时间 * @property {boolean} isPassAll 是否全部通过 * @property {string|number} deployId 对应的部署 id * @property {OneFunctionalTestSerializerType[]} detail 所有测试用例列表 */ /** * @description 代码作业一次页面功能测试一个测试用例的基本信息 * @typedef {Object} OneFunctionalTestSerializerType * @property {number} id 一个测试用例的 id * @property {boolean} isPass 是否通过 * @property {string} message 输出 */ /** * @description 生成FunctionalTestSerializer * @returns {FunctionalTestSerializerType} */ module.exports = ({ id = makeId(), deployId = makeId() }) => { /** * @return {OneFunctionalTestSerializerType} */ const getOneFunctionalTestSerializer = () => ({ id: makeId(), isPass: id % 2 === 1, message: "One Function alTes tSerializerOne FunctionalTestSerializer OneFunc tionalT estSerializer" }); return { id, time: dayjs("2018-9-21").unix(), deployId, isPassAll: id % 2 === 1, detail: [ getOneFunctionalTestSerializer(), getOneFunctionalTestSerializer(), getOneFunctionalTestSerializer(), getOneFunctionalTestSerializer(), getOneFunctionalTestSerializer(), getOneFunctionalTestSerializer(), getOneFunctionalTestSerializer(), getOneFunctionalTestSerializer() ] }; };