FunctionalTestSerializer.js 1.6 KB

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