e2ed
Version:
E2E testing framework over Playwright
21 lines (20 loc) • 719 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.compareByStatuses = void 0;
const internal_1 = require("../../../constants/internal");
const asserts_1 = require("../../asserts");
const indexByStatus = {};
internal_1.ORDER_OF_TEST_RUN_STATUSES_FOR_DISPLAY.forEach((status, index) => {
indexByStatus[status] = index;
});
(0, asserts_1.assertType)(indexByStatus);
/**
* Compares two objects by their `status` field in order of `TestRun` statuses for display.
* @internal
*/
const compareByStatuses = (a, b) => {
const aIndex = indexByStatus[a.status];
const bIndex = indexByStatus[b.status];
return aIndex - bIndex;
};
exports.compareByStatuses = compareByStatuses;