UNPKG

prettier-playwright-msteams-report

Version:
76 lines (75 loc) 2.55 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const getTotalStatus_1 = require("./getTotalStatus"); const baseSuite = { tests: [], title: "test", suites: [], titlePath: () => [""], project: () => undefined, allTests: () => [], entries: () => [], type: "root", }; describe("getTotalStatus", () => { it("should return the correct total status when all tests have passed", () => { const suites = [ Object.assign(Object.assign({}, baseSuite), { allTests: () => [ { outcome: () => "expected" }, { outcome: () => "expected" }, ] }), ]; const result = (0, getTotalStatus_1.getTotalStatus)(suites); expect(result).toEqual({ passed: 2, failed: 0, flaky: 0, skipped: 0, }); }); it("should return the correct flaky total when there are flaky tests", () => { const suites = [ Object.assign(Object.assign({}, baseSuite), { allTests: () => [ { outcome: () => "expected" }, { outcome: () => "expected" }, { outcome: () => "unexpected" }, { outcome: () => "flaky" }, ] }), ]; const result = (0, getTotalStatus_1.getTotalStatus)(suites); expect(result).toEqual({ passed: 2, failed: 1, flaky: 1, skipped: 0, }); }); it("should return the correct total status when there are failed, skipped tests", () => { const suites = [ Object.assign(Object.assign({}, baseSuite), { allTests: () => [ { outcome: () => "expected" }, { outcome: () => "unexpected" }, { outcome: () => "flaky" }, { outcome: () => "unexpected" }, { outcome: () => "skipped" }, ] }), ]; const result = (0, getTotalStatus_1.getTotalStatus)(suites); expect(result).toEqual({ passed: 1, failed: 2, flaky: 1, skipped: 1, }); }); it("should return the correct total status when there are no tests", () => { const suites = []; const result = (0, getTotalStatus_1.getTotalStatus)(suites); expect(result).toEqual({ passed: 0, failed: 0, flaky: 0, skipped: 0, }); }); });