FunctionalTestSerializer.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. const makeId = require("../../util/makeId");
  2. const dayjs = require("dayjs");
  3. /**
  4. * @description 代码作业一次功能测试的基本信息
  5. * @typedef {Object} FunctionalTestSerializerType
  6. * @property {number} id 代码作业一次功能测试的 id
  7. * @property {number} time 测试时间
  8. * @property {string|number} deployId 对应的部署 id
  9. * @property {OneFunctionalTestSerializerType[]} detail 所有测试用例列表
  10. */
  11. /**
  12. * @description 代码作业一次页面功能测试一个测试用例的基本信息
  13. * @typedef {Object} OneFunctionalTestSerializerType
  14. * @property {number} id 一个测试用例的 id
  15. * @property {boolean} isPass 是否通过
  16. * @property {string} message 输出
  17. */
  18. /**
  19. * @description 生成FunctionalTestSerializer
  20. * @returns {FunctionalTestSerializerType}
  21. */
  22. module.exports = ({ id = makeId(), deployId = makeId() }) => {
  23. /**
  24. * @return {OneFunctionalTestSerializerType}
  25. */
  26. const getOneFunctionalTestSerializer = () => ({
  27. id: makeId(),
  28. isPass: id % 2 === 1,
  29. message:
  30. "One Function alTes tSerializerOne FunctionalTestSerializer OneFunc tionalT estSerializer"
  31. });
  32. return {
  33. id,
  34. time: dayjs("2018-9-21").unix(),
  35. deployId,
  36. detail: [
  37. getOneFunctionalTestSerializer(),
  38. getOneFunctionalTestSerializer(),
  39. getOneFunctionalTestSerializer(),
  40. getOneFunctionalTestSerializer(),
  41. getOneFunctionalTestSerializer(),
  42. getOneFunctionalTestSerializer(),
  43. getOneFunctionalTestSerializer(),
  44. getOneFunctionalTestSerializer()
  45. ]
  46. };
  47. };