serverless-openapi-documenter 0.0.97 → 0.0.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -7
- package/package.json +1 -1
- package/src/definitionGenerator.js +14 -10
- package/test/helpers/redocly.json +4 -0
- package/test/unit/definitionGenerator.spec.js +749 -587
- package/test/unit/openAPIGenerator.spec.js +10 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
|
|
4
6
|
const PostmanGenerator = require("openapi-to-postmanv2");
|
|
5
7
|
const sinon = require("sinon");
|
|
6
8
|
const expect = require("chai").expect;
|
|
@@ -14,6 +16,7 @@ const OpenAPIGenerator = require("../../src/openAPIGenerator");
|
|
|
14
16
|
|
|
15
17
|
describe("OpenAPIGenerator", () => {
|
|
16
18
|
let sls, logOutput;
|
|
19
|
+
|
|
17
20
|
beforeEach(function () {
|
|
18
21
|
sls = {
|
|
19
22
|
service: {
|
|
@@ -58,6 +61,11 @@ describe("OpenAPIGenerator", () => {
|
|
|
58
61
|
};
|
|
59
62
|
});
|
|
60
63
|
|
|
64
|
+
after(function () {
|
|
65
|
+
delete require
|
|
66
|
+
.cache[require.resolve(`${path.resolve("options")}/redocly.json`)];
|
|
67
|
+
});
|
|
68
|
+
|
|
61
69
|
describe("generationAndValidation", () => {
|
|
62
70
|
it("should correctly generate a valid openAPI document", async function () {
|
|
63
71
|
const succSpy = sinon.spy(logOutput.log, "success");
|
|
@@ -168,9 +176,11 @@ describe("OpenAPIGenerator", () => {
|
|
|
168
176
|
const errSpy = sinon.spy(logOutput.log, "error");
|
|
169
177
|
|
|
170
178
|
Object.assign(sls.service, basicDocumentation);
|
|
179
|
+
|
|
171
180
|
const getAllFuncsStub = sinon
|
|
172
181
|
.stub(sls.service, "getAllFunctions")
|
|
173
182
|
.returns(["createUser"]);
|
|
183
|
+
|
|
174
184
|
const basicInvalidFunction = JSON.parse(
|
|
175
185
|
JSON.stringify(basicValidFunction)
|
|
176
186
|
);
|