Fix jestOpenAPI call.
This commit is contained in:
parent
8123a04a8e
commit
2c1b10e4a1
|
@ -72,6 +72,10 @@ function writeFile(output: any, filename: string) {
|
||||||
return path
|
return path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function spec() {
|
||||||
|
return swaggerJsdoc({ ...opts, format: ".json" })
|
||||||
|
}
|
||||||
|
|
||||||
export function run() {
|
export function run() {
|
||||||
writeFile(swaggerJsdoc({ ...opts, format: ".json" }), "openapi.json")
|
writeFile(swaggerJsdoc({ ...opts, format: ".json" }), "openapi.json")
|
||||||
return writeFile(swaggerJsdoc({ ...opts, format: ".yaml" }), "openapi.yaml")
|
return writeFile(swaggerJsdoc({ ...opts, format: ".yaml" }), "openapi.yaml")
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
import jestOpenAPI from "jest-openapi"
|
import jestOpenAPI from "jest-openapi"
|
||||||
import { run as generateSchema } from "../../../../specs/generate"
|
import { spec } from "../../../../specs/generate"
|
||||||
import TestConfiguration from "../TestConfiguration"
|
import TestConfiguration from "../TestConfiguration"
|
||||||
import request, { SuperTest, Test, Response } from "supertest"
|
import request, { SuperTest, Test, Response } from "supertest"
|
||||||
import { ReadStream } from "fs"
|
import { ReadStream } from "fs"
|
||||||
import { getServer } from "../../../app"
|
import { getServer } from "../../../app"
|
||||||
|
|
||||||
const yamlPath = generateSchema()
|
jestOpenAPI(spec() as any)
|
||||||
jestOpenAPI(yamlPath!)
|
|
||||||
|
|
||||||
type Headers = Record<string, string | string[] | undefined>
|
type Headers = Record<string, string | string[] | undefined>
|
||||||
type Method = "get" | "post" | "put" | "patch" | "delete"
|
type Method = "get" | "post" | "put" | "patch" | "delete"
|
||||||
|
|
Loading…
Reference in New Issue