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