Source: test-result-dto.js

import TestInteractionDTO from './test-interaction-dto.js'

/**
 *
 */
class TestResultDTO {
  constructor (json) {
    /** @private */
    this.json = json
  }

  /**
   * @type {string}
   */
  get errorMessage () {
    return this.json.error?.message
  }

  /**
   * @type {TestInteractionDTO[]}
   */
  get interactions () {
    return this.json.interactions.map(o => new TestInteractionDTO(o))
  }

  /**
   * @type {('ERROR' | 'FAIL' | 'PASS')}
   */
  get status () {
    return this.json.status
  }

  /**
   * @type {Test}
   */
  get test () {
    return this.json.test
  }

  /**
   * @returns {any}
   */
  toJSON () {
    return this.json
  }
}

/**
 * @typedef Test
 * @property {string} name
 * @property {TestSuite} testSuite
 *
 * @typedef TestSuite
 * @property {string} name

 */
export default TestResultDTO