Skip to content

Commit

Permalink
improved coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosrivera committed Mar 5, 2021
1 parent 7feb721 commit c2937a4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .jest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"transform": {
"^.+\\.(t|j)sx?$": "ts-jest"
"^.+\\.(t)sx?$": "ts-jest"
},
"testRegex": "(/tests/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@synx-ai/oas3-mdx",
"version": "0.3.9",
"version": "0.3.10",
"description": "Convert OpenAPI spec to Markdown files.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
14 changes: 5 additions & 9 deletions src/bundler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"use_strict";
"use strict";

/**
* This file loads, bundles and validates an OpenAPI spec.
Expand Down Expand Up @@ -48,14 +48,10 @@ const handleHTTPResponse = (url, res, resolve, reject) => {
*/
const getContentFromURL = (url: string) => {
return new Promise((resolve, reject) => {
if (url.startsWith("http:")) {
http
.get(url, (res) => {
handleHTTPResponse(url, res, resolve, reject);
})
.on("error", reject);
} else if (url.startsWith("https:")) {
https
if (url.startsWith("http")) {
let protocol = url.startsWith("https:") ? https : http;

protocol
.get(url, (res) => {
handleHTTPResponse(url, res, resolve, reject);
})
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"use_strict";
"use strict";

import * as fs from "fs";
import * as path from "path";
Expand Down
2 changes: 1 addition & 1 deletion tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const templatesThatExists = "./example/templates/mdx";
const templatesThatNotExists = "./example/templates/jsx";

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

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

Expand Down

0 comments on commit c2937a4

Please sign in to comment.