Skip to content

Commit 58d70fc

Browse files
committed
clean up
1 parent f25db22 commit 58d70fc

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

src/diff/oasDiff.test.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,26 @@ import sinon from "sinon";
1111
const pq = proxyquire.noCallThru();
1212

1313
describe("oasDiffChangelog", () => {
14+
it("should throw an error if oasdiff is not installed", async () => {
15+
const execStub = sinon.stub();
16+
execStub.callsArgWith(1, new Error("oasdiff not installed"));
17+
18+
const oasDiff = pq("./oasDiff", {
19+
child_process: {
20+
exec: execStub,
21+
},
22+
});
23+
24+
try {
25+
await oasDiff.checkOasDiffIsInstalled();
26+
expect.fail("Expected function to throw an error");
27+
} catch (error) {
28+
expect(error.message).to.equal(
29+
"oasdiff is not installed. Install oasdiff according to https://github.com/oasdiff/oasdiff#installation"
30+
);
31+
}
32+
});
33+
1434
it("should execute oasdiff command with correct parameters for single file mode", async () => {
1535
const execStub = sinon.stub();
1636
// Mock the callback-style exec function
@@ -619,24 +639,4 @@ describe("oasDiffChangelog", () => {
619639
expect(execStub.called).to.be.true;
620640
expect(result).to.equal(1); // Changes should be reported
621641
});
622-
623-
it("should throw an error if oasdiff is not installed", async () => {
624-
const execStub = sinon.stub();
625-
execStub.callsArgWith(1, new Error("oasdiff not installed"));
626-
627-
const oasDiff = pq("./oasDiff", {
628-
child_process: {
629-
exec: execStub,
630-
},
631-
});
632-
633-
try {
634-
await oasDiff.checkOasDiffIsInstalled();
635-
expect.fail("Expected function to throw an error");
636-
} catch (error) {
637-
expect(error.message).to.equal(
638-
"oasdiff is not installed. Install oasdiff according to https://github.com/oasdiff/oasdiff#installation"
639-
);
640-
}
641-
});
642642
});

0 commit comments

Comments
 (0)