Merge branch 'master' of github.com:swagger-api/swagger-ui into ft/oas3

This commit is contained in:
Kyle Shockey
2017-06-13 19:07:58 -07:00
21 changed files with 219 additions and 7107 deletions

View File

@@ -1,6 +1,7 @@
import expect from "expect"
import Im from "immutable"
import curl from "core/curlify"
import win from "core/window"
describe("curlify", function() {
@@ -131,12 +132,35 @@ describe("curlify", function() {
url: "http://example.com",
method: "POST",
headers: { "content-type": "multipart/form-data" },
body: "id=123&name=Sahar"
body: [
["id", "123"],
["name", "Sahar"]
]
}
let curlified = curl(Im.fromJS(req))
expect(curlified).toEqual("curl -X POST \"http://example.com\" -H \"content-type: multipart/form-data\" -F id=123 -F name=Sahar")
expect(curlified).toEqual("curl -X POST \"http://example.com\" -H \"content-type: multipart/form-data\" -F \"id=123\" -F \"name=Sahar\"")
})
it("should print a curl with formData and file", function() {
var file = new win.File()
file.name = "file.txt"
file.type = "text/plain"
var req = {
url: "http://example.com",
method: "POST",
headers: { "content-type": "multipart/form-data" },
body: [
["id", "123"],
["file", file]
]
}
let curlified = curl(Im.fromJS(req))
expect(curlified).toEqual("curl -X POST \"http://example.com\" -H \"content-type: multipart/form-data\" -F \"id=123\" -F \"file=@file.txt;type=text/plain\"")
})
it("prints a curl post statement from an object", function() {

View File

@@ -0,0 +1,13 @@
/* eslint-env mocha */
import expect from "expect"
import path from "path"
import getAbsoluteFSPath from "../../swagger-ui-dist-package/absolute-path"
describe("swagger-ui-dist", function(){
describe("getAbsoluteFSPath", function(){
it("returns absolute path", function(){
const expectedPath = path.resolve(__dirname, "../../swagger-ui-dist-package")
expect(getAbsoluteFSPath()).toEqual(expectedPath)
})
})
})