Skip to content

Commit 0dc3b55

Browse files
committed
make sure we're removing the resolve cache
1 parent df0ba6c commit 0dc3b55

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

test/unit/definitionGenerator.spec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,17 @@ describe("DefinitionGenerator", () => {
1313
const v4 = new RegExp(
1414
/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i
1515
);
16+
1617
beforeEach(function () {
1718
mockServerless = JSON.parse(JSON.stringify(serverlessMock));
1819
Object.assign(mockServerless.service.custom.documentation, modelsDocument);
1920
});
2021

22+
after(function () {
23+
delete require
24+
.cache[require.resolve(`${path.resolve("options")}/redocly.json`)];
25+
});
26+
2127
describe("constructor", () => {
2228
it("should return a definitionGenerator", function () {
2329
const expected = new DefinitionGenerator(mockServerless, {});

test/unit/openAPIGenerator.spec.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"use strict";
22

33
const fs = require("fs");
4+
const path = require("path");
5+
46
const PostmanGenerator = require("openapi-to-postmanv2");
57
const sinon = require("sinon");
68
const expect = require("chai").expect;
@@ -14,6 +16,7 @@ const OpenAPIGenerator = require("../../src/openAPIGenerator");
1416

1517
describe("OpenAPIGenerator", () => {
1618
let sls, logOutput;
19+
1720
beforeEach(function () {
1821
sls = {
1922
service: {
@@ -58,6 +61,11 @@ describe("OpenAPIGenerator", () => {
5861
};
5962
});
6063

64+
after(function () {
65+
delete require
66+
.cache[require.resolve(`${path.resolve("options")}/redocly.json`)];
67+
});
68+
6169
describe("generationAndValidation", () => {
6270
it("should correctly generate a valid openAPI document", async function () {
6371
const succSpy = sinon.spy(logOutput.log, "success");
@@ -168,9 +176,11 @@ describe("OpenAPIGenerator", () => {
168176
const errSpy = sinon.spy(logOutput.log, "error");
169177

170178
Object.assign(sls.service, basicDocumentation);
179+
171180
const getAllFuncsStub = sinon
172181
.stub(sls.service, "getAllFunctions")
173182
.returns(["createUser"]);
183+
174184
const basicInvalidFunction = JSON.parse(
175185
JSON.stringify(basicValidFunction)
176186
);

0 commit comments

Comments
 (0)