Skip to content

Commit

Permalink
. t extracted class
Browse files Browse the repository at this point in the history
Co-Authored-By: Llewellyn Falco <10874+isidore@users.noreply.github.com>
  • Loading branch information
mch and isidore committed Jul 12, 2024
1 parent e847a2a commit a7b66a5
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions test/Reporting/Reporters/multiReporterTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,29 @@ class ExceptionThrowingReporter implements Reporter {
}
}

class TrackingReporter implements Reporter {
private wasReporterUsed = false;
public name: string = "temp-test-reporter";

canReportOn(/*file*/) {
return true;
}

report(/*approved, received*/) {
this.wasReporterUsed = true;
}

getWasReporterUsed() {
return this.wasReporterUsed;
}
}

describe("multiReporter", function () {
it("should use a multiple reporter", function () {
var MultiReporter = approvals.reporters.MultiReporter;
var MyCustomReporter = function () {
var wasReporterUsed = false;
return {
canReportOn: function (/*file*/) {
return true;
},
report: function (/*approved, received*/) {
wasReporterUsed = true;
},
getWasReporterUsed: function () {
return wasReporterUsed;
},
name: "temp-test-reporter",
};
};

var r1 = new MyCustomReporter();
var r2 = new MyCustomReporter();
var r1 = new TrackingReporter();
var r2 = new TrackingReporter();

var multiReporter = new MultiReporter([r1, r2]);

Expand Down

0 comments on commit a7b66a5

Please sign in to comment.