Skip to content

Commit c2937a4

Browse files
committed
improved coverage
1 parent 7feb721 commit c2937a4

File tree

5 files changed

+9
-13
lines changed

5 files changed

+9
-13
lines changed

.jest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"transform": {
3-
"^.+\\.(t|j)sx?$": "ts-jest"
3+
"^.+\\.(t)sx?$": "ts-jest"
44
},
55
"testRegex": "(/tests/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
66
"moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"],

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@synx-ai/oas3-mdx",
3-
"version": "0.3.9",
3+
"version": "0.3.10",
44
"description": "Convert OpenAPI spec to Markdown files.",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/bundler.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"use_strict";
1+
"use strict";
22

33
/**
44
* This file loads, bundles and validates an OpenAPI spec.
@@ -48,14 +48,10 @@ const handleHTTPResponse = (url, res, resolve, reject) => {
4848
*/
4949
const getContentFromURL = (url: string) => {
5050
return new Promise((resolve, reject) => {
51-
if (url.startsWith("http:")) {
52-
http
53-
.get(url, (res) => {
54-
handleHTTPResponse(url, res, resolve, reject);
55-
})
56-
.on("error", reject);
57-
} else if (url.startsWith("https:")) {
58-
https
51+
if (url.startsWith("http")) {
52+
let protocol = url.startsWith("https:") ? https : http;
53+
54+
protocol
5955
.get(url, (res) => {
6056
handleHTTPResponse(url, res, resolve, reject);
6157
})

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"use_strict";
1+
"use strict";
22

33
import * as fs from "fs";
44
import * as path from "path";

tests/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const templatesThatExists = "./example/templates/mdx";
99
const templatesThatNotExists = "./example/templates/jsx";
1010

1111
const urlThatExists = "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml";
12-
const urlThatNotExists = "https://petstore3.synx.io/api/v3/openapi.json";
12+
const urlThatNotExists = "https://github.com/synx-ai/oas3-mdx/blob/master/404";
1313

1414
describe("convert()", () => {
1515

0 commit comments

Comments
 (0)