|
9 | 9 | import { expect } from "chai"; |
10 | 10 | import proxyquire from "proxyquire"; |
11 | 11 | import sinon from "sinon"; |
| 12 | +import { consoleStub } from "../../testResources/setup"; |
12 | 13 |
|
13 | 14 | const pq = proxyquire.noCallThru(); |
14 | 15 |
|
@@ -680,7 +681,6 @@ describe("oasDiffChangelog", () => { |
680 | 681 | }); |
681 | 682 |
|
682 | 683 | it("should normalize directory names when disable-normalize-directory-names flag is false", async () => { |
683 | | - const consoleStub = sinon.stub(console, "log"); |
684 | 684 | const execStub = createMockExec(); |
685 | 685 | execStub.onSecondCall().callsArgWith(1, null, "changes in api-1", ""); |
686 | 686 |
|
@@ -714,19 +714,12 @@ describe("oasDiffChangelog", () => { |
714 | 714 | expect(writtenContent).to.be.a("string"); |
715 | 715 | expect(writtenContent.length).to.be.greaterThan(0); |
716 | 716 |
|
717 | | - // Verify that the console.log stub captured the "Processing directory pair" message |
| 717 | + // Verify that the console.log stub captured the "Processing directory pair" messages |
718 | 718 | expect(consoleStub.called).to.be.true; |
719 | | - const processingMessage = consoleStub.args.find( |
720 | | - // verify that the message contains the normalized directory name |
721 | | - (args) => args[0] === "Processing directory pair: api-1" |
722 | | - ); |
723 | | - expect(processingMessage).to.not.be.undefined; |
724 | | - |
725 | | - // Also verify that api-2 is being processed |
726 | | - const processingMessage2 = consoleStub.args.find( |
727 | | - (args) => args[0] === "Processing directory pair: api-2" |
728 | | - ); |
729 | | - expect(processingMessage2).to.not.be.undefined; |
| 719 | + // flattens the array of arrays into a single array of strings |
| 720 | + const allMessages = consoleStub.args.map((args) => args[0]); |
| 721 | + expect(allMessages).to.include("Processing directory pair: api-1"); |
| 722 | + expect(allMessages).to.include("Processing directory pair: api-2"); |
730 | 723 | consoleStub.restore(); |
731 | 724 | }); |
732 | 725 |
|
|
0 commit comments