style: replace var with let in /test files (#6164)
This commit is contained in:
@@ -1,13 +1,13 @@
|
|||||||
// from https://github.com/pedroetb/node-oauth2-server-example
|
// from https://github.com/pedroetb/node-oauth2-server-example
|
||||||
|
|
||||||
var Http = require("http")
|
let Http = require("http")
|
||||||
var path = require("path")
|
let path = require("path")
|
||||||
var express = require("express")
|
let express = require("express")
|
||||||
var bodyParser = require("body-parser")
|
let bodyParser = require("body-parser")
|
||||||
var oauthserver = require("oauth2-server")
|
let oauthserver = require("oauth2-server")
|
||||||
var cors = require("cors")
|
let cors = require("cors")
|
||||||
|
|
||||||
var app = express()
|
let app = express()
|
||||||
|
|
||||||
app.use(cors())
|
app.use(cors())
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ app.get("*", app.oauth.authorise(), function (req, res) {
|
|||||||
app.use(app.oauth.errorHandler())
|
app.use(app.oauth.errorHandler())
|
||||||
|
|
||||||
function startServer() {
|
function startServer() {
|
||||||
var httpServer = Http.createServer(app)
|
let httpServer = Http.createServer(app)
|
||||||
httpServer.listen("3231")
|
httpServer.listen("3231")
|
||||||
|
|
||||||
return function stopServer() {
|
return function stopServer() {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// from https://github.com/pedroetb/node-oauth2-server-example
|
// from https://github.com/pedroetb/node-oauth2-server-example
|
||||||
|
|
||||||
var config = {
|
let config = {
|
||||||
clients: [{
|
clients: [{
|
||||||
clientId: "application",
|
clientId: "application",
|
||||||
clientSecret: "secret"
|
clientSecret: "secret"
|
||||||
@@ -21,7 +21,7 @@ var config = {
|
|||||||
* Dump the memory storage content (for debug).
|
* Dump the memory storage content (for debug).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var dump = function () {
|
let dump = function () {
|
||||||
|
|
||||||
console.log("clients", config.clients)
|
console.log("clients", config.clients)
|
||||||
console.log("confidentialClients", config.confidentialClients)
|
console.log("confidentialClients", config.confidentialClients)
|
||||||
@@ -33,9 +33,9 @@ var dump = function () {
|
|||||||
* Methods used by all grant types.
|
* Methods used by all grant types.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var getAccessToken = function (bearerToken, callback) {
|
let getAccessToken = function (bearerToken, callback) {
|
||||||
|
|
||||||
var tokens = config.tokens.filter(function (token) {
|
let tokens = config.tokens.filter(function (token) {
|
||||||
|
|
||||||
return token.accessToken === bearerToken
|
return token.accessToken === bearerToken
|
||||||
})
|
})
|
||||||
@@ -43,14 +43,14 @@ var getAccessToken = function (bearerToken, callback) {
|
|||||||
return callback(false, tokens[0])
|
return callback(false, tokens[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
var getClient = function (clientId, clientSecret, callback) {
|
let getClient = function (clientId, clientSecret, callback) {
|
||||||
|
|
||||||
var clients = config.clients.filter(function (client) {
|
let clients = config.clients.filter(function (client) {
|
||||||
|
|
||||||
return client.clientId === clientId && client.clientSecret === clientSecret
|
return client.clientId === clientId && client.clientSecret === clientSecret
|
||||||
})
|
})
|
||||||
|
|
||||||
var confidentialClients = config.confidentialClients.filter(function (client) {
|
let confidentialClients = config.confidentialClients.filter(function (client) {
|
||||||
|
|
||||||
return client.clientId === clientId && client.clientSecret === clientSecret
|
return client.clientId === clientId && client.clientSecret === clientSecret
|
||||||
})
|
})
|
||||||
@@ -58,9 +58,9 @@ var getClient = function (clientId, clientSecret, callback) {
|
|||||||
callback(false, clients[0] || confidentialClients[0])
|
callback(false, clients[0] || confidentialClients[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
var grantTypeAllowed = function (clientId, grantType, callback) {
|
let grantTypeAllowed = function (clientId, grantType, callback) {
|
||||||
|
|
||||||
var clientsSource,
|
let clientsSource,
|
||||||
clients = []
|
clients = []
|
||||||
|
|
||||||
if (grantType === "password") {
|
if (grantType === "password") {
|
||||||
@@ -79,7 +79,7 @@ var grantTypeAllowed = function (clientId, grantType, callback) {
|
|||||||
callback(false, clients.length)
|
callback(false, clients.length)
|
||||||
}
|
}
|
||||||
|
|
||||||
var saveAccessToken = function (accessToken, clientId, expires, user, callback) {
|
let saveAccessToken = function (accessToken, clientId, expires, user, callback) {
|
||||||
|
|
||||||
config.tokens.push({
|
config.tokens.push({
|
||||||
accessToken: accessToken,
|
accessToken: accessToken,
|
||||||
@@ -95,9 +95,9 @@ var saveAccessToken = function (accessToken, clientId, expires, user, callback)
|
|||||||
* Method used only by password grant type.
|
* Method used only by password grant type.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var getUser = function (username, password, callback) {
|
let getUser = function (username, password, callback) {
|
||||||
|
|
||||||
var users = config.users.filter(function (user) {
|
let users = config.users.filter(function (user) {
|
||||||
|
|
||||||
return user.username === username && user.password === password
|
return user.username === username && user.password === password
|
||||||
})
|
})
|
||||||
@@ -109,14 +109,14 @@ var getUser = function (username, password, callback) {
|
|||||||
* Method used only by client_credentials grant type.
|
* Method used only by client_credentials grant type.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var getUserFromClient = function (clientId, clientSecret, callback) {
|
let getUserFromClient = function (clientId, clientSecret, callback) {
|
||||||
|
|
||||||
var clients = config.confidentialClients.filter(function (client) {
|
let clients = config.confidentialClients.filter(function (client) {
|
||||||
|
|
||||||
return client.clientId === clientId && client.clientSecret === clientSecret
|
return client.clientId === clientId && client.clientSecret === clientSecret
|
||||||
})
|
})
|
||||||
|
|
||||||
var user
|
let user
|
||||||
|
|
||||||
if (clients.length) {
|
if (clients.length) {
|
||||||
user = {
|
user = {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import win from "core/window"
|
|||||||
describe("curlify", function () {
|
describe("curlify", function () {
|
||||||
|
|
||||||
it("prints a curl statement with custom content-type", function () {
|
it("prints a curl statement with custom content-type", function () {
|
||||||
var req = {
|
let req = {
|
||||||
url: "http://example.com",
|
url: "http://example.com",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: {
|
body: {
|
||||||
@@ -26,7 +26,7 @@ describe("curlify", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("does add a empty data param if no request body given", function () {
|
it("does add a empty data param if no request body given", function () {
|
||||||
var req = {
|
let req = {
|
||||||
url: "http://example.com",
|
url: "http://example.com",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
}
|
}
|
||||||
@@ -37,7 +37,7 @@ describe("curlify", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("does not change the case of header in curl", function () {
|
it("does not change the case of header in curl", function () {
|
||||||
var req = {
|
let req = {
|
||||||
url: "http://example.com",
|
url: "http://example.com",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
@@ -51,7 +51,7 @@ describe("curlify", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("prints a curl statement with an array of query params", function () {
|
it("prints a curl statement with an array of query params", function () {
|
||||||
var req = {
|
let req = {
|
||||||
url: "http://swaggerhub.com/v1/one?name=john|smith",
|
url: "http://swaggerhub.com/v1/one?name=john|smith",
|
||||||
method: "GET"
|
method: "GET"
|
||||||
}
|
}
|
||||||
@@ -62,7 +62,7 @@ describe("curlify", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("prints a curl statement with an array of query params and auth", function () {
|
it("prints a curl statement with an array of query params and auth", function () {
|
||||||
var req = {
|
let req = {
|
||||||
url: "http://swaggerhub.com/v1/one?name=john|smith",
|
url: "http://swaggerhub.com/v1/one?name=john|smith",
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
@@ -76,7 +76,7 @@ describe("curlify", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("prints a curl statement with html", function () {
|
it("prints a curl statement with html", function () {
|
||||||
var req = {
|
let req = {
|
||||||
url: "http://swaggerhub.com/v1/one?name=john|smith",
|
url: "http://swaggerhub.com/v1/one?name=john|smith",
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
@@ -93,7 +93,7 @@ describe("curlify", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("handles post body with html", function () {
|
it("handles post body with html", function () {
|
||||||
var req = {
|
let req = {
|
||||||
url: "http://swaggerhub.com/v1/one?name=john|smith",
|
url: "http://swaggerhub.com/v1/one?name=john|smith",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
@@ -110,7 +110,7 @@ describe("curlify", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("handles post body with special chars", function () {
|
it("handles post body with special chars", function () {
|
||||||
var req = {
|
let req = {
|
||||||
url: "http://swaggerhub.com/v1/one?name=john|smith",
|
url: "http://swaggerhub.com/v1/one?name=john|smith",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: {
|
body: {
|
||||||
@@ -125,7 +125,7 @@ describe("curlify", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("handles delete form with parameters", function () {
|
it("handles delete form with parameters", function () {
|
||||||
var req = {
|
let req = {
|
||||||
url: "http://example.com",
|
url: "http://example.com",
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
headers: {
|
headers: {
|
||||||
@@ -139,7 +139,7 @@ describe("curlify", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("should print a curl with formData", function () {
|
it("should print a curl with formData", function () {
|
||||||
var req = {
|
let req = {
|
||||||
url: "http://example.com",
|
url: "http://example.com",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "content-type": "multipart/form-data" },
|
headers: { "content-type": "multipart/form-data" },
|
||||||
@@ -175,11 +175,11 @@ describe("curlify", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("should print a curl with formData and file", function () {
|
it("should print a curl with formData and file", function () {
|
||||||
var file = new win.File()
|
let file = new win.File()
|
||||||
file.name = "file.txt"
|
file.name = "file.txt"
|
||||||
file.type = "text/plain"
|
file.type = "text/plain"
|
||||||
|
|
||||||
var req = {
|
let req = {
|
||||||
url: "http://example.com",
|
url: "http://example.com",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "content-type": "multipart/form-data" },
|
headers: { "content-type": "multipart/form-data" },
|
||||||
@@ -195,11 +195,11 @@ describe("curlify", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("should print a curl without form data type if type is unknown", function () {
|
it("should print a curl without form data type if type is unknown", function () {
|
||||||
var file = new win.File()
|
let file = new win.File()
|
||||||
file.name = "file.txt"
|
file.name = "file.txt"
|
||||||
file.type = ""
|
file.type = ""
|
||||||
|
|
||||||
var req = {
|
let req = {
|
||||||
url: "http://example.com",
|
url: "http://example.com",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "content-type": "multipart/form-data" },
|
headers: { "content-type": "multipart/form-data" },
|
||||||
@@ -215,7 +215,7 @@ describe("curlify", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("prints a curl post statement from an object", function () {
|
it("prints a curl post statement from an object", function () {
|
||||||
var req = {
|
let req = {
|
||||||
url: "http://example.com",
|
url: "http://example.com",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
@@ -232,7 +232,7 @@ describe("curlify", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("prints a curl post statement from a string containing a single quote", function () {
|
it("prints a curl post statement from a string containing a single quote", function () {
|
||||||
var req = {
|
let req = {
|
||||||
url: "http://example.com",
|
url: "http://example.com",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import expect from "expect"
|
|||||||
|
|
||||||
describe("sampleFromSchema", function() {
|
describe("sampleFromSchema", function() {
|
||||||
it("handles Immutable.js objects for nested schemas", function () {
|
it("handles Immutable.js objects for nested schemas", function () {
|
||||||
var definition = fromJS({
|
let definition = fromJS({
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"json": {
|
"json": {
|
||||||
@@ -21,7 +21,7 @@ describe("sampleFromSchema", function() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
var expected = {
|
let expected = {
|
||||||
json: {
|
json: {
|
||||||
a: "string"
|
a: "string"
|
||||||
}
|
}
|
||||||
@@ -31,7 +31,7 @@ describe("sampleFromSchema", function() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns object with no readonly fields for parameter", function () {
|
it("returns object with no readonly fields for parameter", function () {
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
id: {
|
id: {
|
||||||
@@ -47,7 +47,7 @@ describe("sampleFromSchema", function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var expected = {
|
let expected = {
|
||||||
id: 0
|
id: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ describe("sampleFromSchema", function() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns object with readonly fields for parameter, with includeReadOnly", function () {
|
it("returns object with readonly fields for parameter, with includeReadOnly", function () {
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
id: {
|
id: {
|
||||||
@@ -71,7 +71,7 @@ describe("sampleFromSchema", function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var expected = {
|
let expected = {
|
||||||
id: 0,
|
id: 0,
|
||||||
readOnlyDog: "string"
|
readOnlyDog: "string"
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,7 @@ describe("sampleFromSchema", function() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns object without deprecated fields for parameter", function () {
|
it("returns object without deprecated fields for parameter", function () {
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
id: {
|
id: {
|
||||||
@@ -96,7 +96,7 @@ describe("sampleFromSchema", function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var expected = {
|
let expected = {
|
||||||
id: 0
|
id: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ describe("sampleFromSchema", function() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns object without writeonly fields for parameter", function () {
|
it("returns object without writeonly fields for parameter", function () {
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
id: {
|
id: {
|
||||||
@@ -120,7 +120,7 @@ describe("sampleFromSchema", function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var expected = {
|
let expected = {
|
||||||
id: 0
|
id: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ describe("sampleFromSchema", function() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns object with writeonly fields for parameter, with includeWriteOnly", function () {
|
it("returns object with writeonly fields for parameter, with includeWriteOnly", function () {
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
id: {
|
id: {
|
||||||
@@ -144,7 +144,7 @@ describe("sampleFromSchema", function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var expected = {
|
let expected = {
|
||||||
id: 0,
|
id: 0,
|
||||||
writeOnlyDog: "string"
|
writeOnlyDog: "string"
|
||||||
}
|
}
|
||||||
@@ -153,7 +153,7 @@ describe("sampleFromSchema", function() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns object without any $$ref fields at the root schema level", function () {
|
it("returns object without any $$ref fields at the root schema level", function () {
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
message: {
|
message: {
|
||||||
@@ -169,7 +169,7 @@ describe("sampleFromSchema", function() {
|
|||||||
$$ref: "#/components/schemas/Welcome"
|
$$ref: "#/components/schemas/Welcome"
|
||||||
}
|
}
|
||||||
|
|
||||||
var expected = {
|
let expected = {
|
||||||
"value": {
|
"value": {
|
||||||
"message": "Hello, World!"
|
"message": "Hello, World!"
|
||||||
}
|
}
|
||||||
@@ -179,7 +179,7 @@ describe("sampleFromSchema", function() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns object without any $$ref fields at nested schema levels", function () {
|
it("returns object without any $$ref fields at nested schema levels", function () {
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
message: {
|
message: {
|
||||||
@@ -197,7 +197,7 @@ describe("sampleFromSchema", function() {
|
|||||||
$$ref: "#/components/schemas/Welcome"
|
$$ref: "#/components/schemas/Welcome"
|
||||||
}
|
}
|
||||||
|
|
||||||
var expected = {
|
let expected = {
|
||||||
a: {
|
a: {
|
||||||
"value": {
|
"value": {
|
||||||
"message": "Hello, World!"
|
"message": "Hello, World!"
|
||||||
@@ -209,7 +209,7 @@ describe("sampleFromSchema", function() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns object with any $$ref fields that appear to be user-created", function () {
|
it("returns object with any $$ref fields that appear to be user-created", function () {
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
message: {
|
message: {
|
||||||
@@ -227,7 +227,7 @@ describe("sampleFromSchema", function() {
|
|||||||
$$ref: "#/components/schemas/Welcome"
|
$$ref: "#/components/schemas/Welcome"
|
||||||
}
|
}
|
||||||
|
|
||||||
var expected = {
|
let expected = {
|
||||||
$$ref: {
|
$$ref: {
|
||||||
"value": {
|
"value": {
|
||||||
"message": "Hello, World!"
|
"message": "Hello, World!"
|
||||||
@@ -239,7 +239,7 @@ describe("sampleFromSchema", function() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns example value for date-time property", function() {
|
it("returns example value for date-time property", function() {
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "string",
|
type: "string",
|
||||||
format: "date-time"
|
format: "date-time"
|
||||||
}
|
}
|
||||||
@@ -247,82 +247,82 @@ describe("sampleFromSchema", function() {
|
|||||||
// 0-20 chops off milliseconds
|
// 0-20 chops off milliseconds
|
||||||
// necessary because test latency can cause failures
|
// necessary because test latency can cause failures
|
||||||
// it would be better to mock Date globally and expect a string - KS 11/18
|
// it would be better to mock Date globally and expect a string - KS 11/18
|
||||||
var expected = new Date().toISOString().substring(0, 20)
|
let expected = new Date().toISOString().substring(0, 20)
|
||||||
|
|
||||||
expect(sampleFromSchema(definition)).toInclude(expected)
|
expect(sampleFromSchema(definition)).toInclude(expected)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("returns example value for date property", function() {
|
it("returns example value for date property", function() {
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "string",
|
type: "string",
|
||||||
format: "date"
|
format: "date"
|
||||||
}
|
}
|
||||||
|
|
||||||
var expected = new Date().toISOString().substring(0, 10)
|
let expected = new Date().toISOString().substring(0, 10)
|
||||||
|
|
||||||
expect(sampleFromSchema(definition)).toEqual(expected)
|
expect(sampleFromSchema(definition)).toEqual(expected)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("returns a UUID for a string with format=uuid", function() {
|
it("returns a UUID for a string with format=uuid", function() {
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "string",
|
type: "string",
|
||||||
format: "uuid"
|
format: "uuid"
|
||||||
}
|
}
|
||||||
|
|
||||||
var expected = "3fa85f64-5717-4562-b3fc-2c963f66afa6"
|
let expected = "3fa85f64-5717-4562-b3fc-2c963f66afa6"
|
||||||
|
|
||||||
expect(sampleFromSchema(definition)).toEqual(expected)
|
expect(sampleFromSchema(definition)).toEqual(expected)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("returns a hostname for a string with format=hostname", function() {
|
it("returns a hostname for a string with format=hostname", function() {
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "string",
|
type: "string",
|
||||||
format: "hostname"
|
format: "hostname"
|
||||||
}
|
}
|
||||||
|
|
||||||
var expected = "example.com"
|
let expected = "example.com"
|
||||||
|
|
||||||
expect(sampleFromSchema(definition)).toEqual(expected)
|
expect(sampleFromSchema(definition)).toEqual(expected)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("returns an IPv4 address for a string with format=ipv4", function() {
|
it("returns an IPv4 address for a string with format=ipv4", function() {
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "string",
|
type: "string",
|
||||||
format: "ipv4"
|
format: "ipv4"
|
||||||
}
|
}
|
||||||
|
|
||||||
var expected = "198.51.100.42"
|
let expected = "198.51.100.42"
|
||||||
|
|
||||||
expect(sampleFromSchema(definition)).toEqual(expected)
|
expect(sampleFromSchema(definition)).toEqual(expected)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("returns an IPv6 address for a string with format=ipv6", function() {
|
it("returns an IPv6 address for a string with format=ipv6", function() {
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "string",
|
type: "string",
|
||||||
format: "ipv6"
|
format: "ipv6"
|
||||||
}
|
}
|
||||||
|
|
||||||
var expected = "2001:0db8:5b96:0000:0000:426f:8e17:642a"
|
let expected = "2001:0db8:5b96:0000:0000:426f:8e17:642a"
|
||||||
|
|
||||||
expect(sampleFromSchema(definition)).toEqual(expected)
|
expect(sampleFromSchema(definition)).toEqual(expected)
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("for array type", function() {
|
describe("for array type", function() {
|
||||||
it("returns array with sample of array type", function() {
|
it("returns array with sample of array type", function() {
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "array",
|
type: "array",
|
||||||
items: {
|
items: {
|
||||||
type: "integer"
|
type: "integer"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var expected = [ 0 ]
|
let expected = [ 0 ]
|
||||||
|
|
||||||
expect(sampleFromSchema(definition)).toEqual(expected)
|
expect(sampleFromSchema(definition)).toEqual(expected)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("returns array of examples for array that has example", function() {
|
it("returns array of examples for array that has example", function() {
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "array",
|
type: "array",
|
||||||
items: {
|
items: {
|
||||||
type: "string"
|
type: "string"
|
||||||
@@ -330,13 +330,13 @@ describe("sampleFromSchema", function() {
|
|||||||
example: "dog"
|
example: "dog"
|
||||||
}
|
}
|
||||||
|
|
||||||
var expected = [ "dog" ]
|
let expected = [ "dog" ]
|
||||||
|
|
||||||
expect(sampleFromSchema(definition)).toEqual(expected)
|
expect(sampleFromSchema(definition)).toEqual(expected)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("returns array of examples for array that has examples", function() {
|
it("returns array of examples for array that has examples", function() {
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "array",
|
type: "array",
|
||||||
items: {
|
items: {
|
||||||
type: "string",
|
type: "string",
|
||||||
@@ -344,13 +344,13 @@ describe("sampleFromSchema", function() {
|
|||||||
example: [ "dog", "cat" ]
|
example: [ "dog", "cat" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
var expected = [ "dog", "cat" ]
|
let expected = [ "dog", "cat" ]
|
||||||
|
|
||||||
expect(sampleFromSchema(definition)).toEqual(expected)
|
expect(sampleFromSchema(definition)).toEqual(expected)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("returns array of samples for oneOf type", function() {
|
it("returns array of samples for oneOf type", function() {
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "array",
|
type: "array",
|
||||||
items: {
|
items: {
|
||||||
type: "string",
|
type: "string",
|
||||||
@@ -362,13 +362,13 @@ describe("sampleFromSchema", function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var expected = [ 0 ]
|
let expected = [ 0 ]
|
||||||
|
|
||||||
expect(sampleFromSchema(definition)).toEqual(expected)
|
expect(sampleFromSchema(definition)).toEqual(expected)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("returns array of samples for oneOf types", function() {
|
it("returns array of samples for oneOf types", function() {
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "array",
|
type: "array",
|
||||||
items: {
|
items: {
|
||||||
type: "string",
|
type: "string",
|
||||||
@@ -383,13 +383,13 @@ describe("sampleFromSchema", function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var expected = [ "string", 0 ]
|
let expected = [ "string", 0 ]
|
||||||
|
|
||||||
expect(sampleFromSchema(definition)).toEqual(expected)
|
expect(sampleFromSchema(definition)).toEqual(expected)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("returns array of samples for oneOf examples", function() {
|
it("returns array of samples for oneOf examples", function() {
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "array",
|
type: "array",
|
||||||
items: {
|
items: {
|
||||||
type: "string",
|
type: "string",
|
||||||
@@ -406,13 +406,13 @@ describe("sampleFromSchema", function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var expected = [ "dog", 1 ]
|
let expected = [ "dog", 1 ]
|
||||||
|
|
||||||
expect(sampleFromSchema(definition)).toEqual(expected)
|
expect(sampleFromSchema(definition)).toEqual(expected)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("returns array of samples for anyOf type", function() {
|
it("returns array of samples for anyOf type", function() {
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "array",
|
type: "array",
|
||||||
items: {
|
items: {
|
||||||
type: "string",
|
type: "string",
|
||||||
@@ -424,13 +424,13 @@ describe("sampleFromSchema", function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var expected = [ 0 ]
|
let expected = [ 0 ]
|
||||||
|
|
||||||
expect(sampleFromSchema(definition)).toEqual(expected)
|
expect(sampleFromSchema(definition)).toEqual(expected)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("returns array of samples for anyOf types", function() {
|
it("returns array of samples for anyOf types", function() {
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "array",
|
type: "array",
|
||||||
items: {
|
items: {
|
||||||
type: "string",
|
type: "string",
|
||||||
@@ -445,13 +445,13 @@ describe("sampleFromSchema", function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var expected = [ "string", 0 ]
|
let expected = [ "string", 0 ]
|
||||||
|
|
||||||
expect(sampleFromSchema(definition)).toEqual(expected)
|
expect(sampleFromSchema(definition)).toEqual(expected)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("returns array of samples for anyOf examples", function() {
|
it("returns array of samples for anyOf examples", function() {
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "array",
|
type: "array",
|
||||||
items: {
|
items: {
|
||||||
type: "string",
|
type: "string",
|
||||||
@@ -468,13 +468,13 @@ describe("sampleFromSchema", function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var expected = [ "dog", 1 ]
|
let expected = [ "dog", 1 ]
|
||||||
|
|
||||||
expect(sampleFromSchema(definition)).toEqual(expected)
|
expect(sampleFromSchema(definition)).toEqual(expected)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("returns null for a null example", function() {
|
it("returns null for a null example", function() {
|
||||||
var definition = {
|
let definition = {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"foo": {
|
"foo": {
|
||||||
@@ -485,7 +485,7 @@ describe("sampleFromSchema", function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var expected = {
|
let expected = {
|
||||||
foo: null
|
foo: null
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -493,7 +493,7 @@ describe("sampleFromSchema", function() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns null for a null object-level example", function() {
|
it("returns null for a null object-level example", function() {
|
||||||
var definition = {
|
let definition = {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"foo": {
|
"foo": {
|
||||||
@@ -506,7 +506,7 @@ describe("sampleFromSchema", function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var expected = {
|
let expected = {
|
||||||
foo: null
|
foo: null
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -516,10 +516,10 @@ describe("sampleFromSchema", function() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe("createXMLExample", function () {
|
describe("createXMLExample", function () {
|
||||||
var sut = createXMLExample
|
let sut = createXMLExample
|
||||||
describe("simple types with xml property", function () {
|
describe("simple types with xml property", function () {
|
||||||
it("returns tag <newtagname>string</newtagname> when passing type string and xml:{name: \"newtagname\"}", function () {
|
it("returns tag <newtagname>string</newtagname> when passing type string and xml:{name: \"newtagname\"}", function () {
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "string",
|
type: "string",
|
||||||
xml: {
|
xml: {
|
||||||
name: "newtagname"
|
name: "newtagname"
|
||||||
@@ -530,7 +530,7 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns tag <test:newtagname>string</test:newtagname> when passing type string and xml:{name: \"newtagname\", prefix:\"test\"}", function () {
|
it("returns tag <test:newtagname>string</test:newtagname> when passing type string and xml:{name: \"newtagname\", prefix:\"test\"}", function () {
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "string",
|
type: "string",
|
||||||
xml: {
|
xml: {
|
||||||
name: "newtagname",
|
name: "newtagname",
|
||||||
@@ -542,7 +542,7 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns tag <test:tagname xmlns:sample=\"http://swagger.io/schema/sample\">string</test:tagname> when passing type string and xml:{\"namespace\": \"http://swagger.io/schema/sample\", \"prefix\": \"sample\"}", function () {
|
it("returns tag <test:tagname xmlns:sample=\"http://swagger.io/schema/sample\">string</test:tagname> when passing type string and xml:{\"namespace\": \"http://swagger.io/schema/sample\", \"prefix\": \"sample\"}", function () {
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "string",
|
type: "string",
|
||||||
xml: {
|
xml: {
|
||||||
namespace: "http://swagger.io/schema/sample",
|
namespace: "http://swagger.io/schema/sample",
|
||||||
@@ -555,7 +555,7 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns tag <test:tagname >string</test:tagname> when passing type string and xml:{\"namespace\": \"http://swagger.io/schema/sample\"}", function () {
|
it("returns tag <test:tagname >string</test:tagname> when passing type string and xml:{\"namespace\": \"http://swagger.io/schema/sample\"}", function () {
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "string",
|
type: "string",
|
||||||
xml: {
|
xml: {
|
||||||
namespace: "http://swagger.io/schema/sample",
|
namespace: "http://swagger.io/schema/sample",
|
||||||
@@ -567,8 +567,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns tag <newtagname>test</newtagname> when passing default value", function () {
|
it("returns tag <newtagname>test</newtagname> when passing default value", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<newtagname>test</newtagname>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<newtagname>test</newtagname>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "string",
|
type: "string",
|
||||||
"default": "test",
|
"default": "test",
|
||||||
xml: {
|
xml: {
|
||||||
@@ -580,8 +580,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns default value when enum provided", function () {
|
it("returns default value when enum provided", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<newtagname>one</newtagname>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<newtagname>one</newtagname>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "string",
|
type: "string",
|
||||||
"default": "one",
|
"default": "one",
|
||||||
"enum": ["two", "one"],
|
"enum": ["two", "one"],
|
||||||
@@ -594,8 +594,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns example value when provided", function () {
|
it("returns example value when provided", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<newtagname>two</newtagname>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<newtagname>two</newtagname>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "string",
|
type: "string",
|
||||||
"default": "one",
|
"default": "one",
|
||||||
"example": "two",
|
"example": "two",
|
||||||
@@ -609,8 +609,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("sets first enum if provided", function () {
|
it("sets first enum if provided", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<newtagname>one</newtagname>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<newtagname>one</newtagname>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "string",
|
type: "string",
|
||||||
"enum": ["one", "two"],
|
"enum": ["one", "two"],
|
||||||
xml: {
|
xml: {
|
||||||
@@ -624,8 +624,8 @@ describe("createXMLExample", function () {
|
|||||||
|
|
||||||
describe("array", function () {
|
describe("array", function () {
|
||||||
it("returns tag <tagname>string</tagname> when passing string items", function () {
|
it("returns tag <tagname>string</tagname> when passing string items", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<tagname>string</tagname>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<tagname>string</tagname>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "array",
|
type: "array",
|
||||||
items: {
|
items: {
|
||||||
type: "string"
|
type: "string"
|
||||||
@@ -639,8 +639,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns tag <animal>string</animal> when passing string items with name", function () {
|
it("returns tag <animal>string</animal> when passing string items with name", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animal>string</animal>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animal>string</animal>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "array",
|
type: "array",
|
||||||
items: {
|
items: {
|
||||||
type: "string",
|
type: "string",
|
||||||
@@ -657,8 +657,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns tag <animals><animal>string</animal></animals> when passing string items with name", function () {
|
it("returns tag <animals><animal>string</animal></animals> when passing string items with name", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>string</animal>\n</animals>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>string</animal>\n</animals>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "array",
|
type: "array",
|
||||||
items: {
|
items: {
|
||||||
type: "string",
|
type: "string",
|
||||||
@@ -676,8 +676,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("return correct nested wrapped array", function () {
|
it("return correct nested wrapped array", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens>\n\t<dog>string</dog>\n</aliens>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens>\n\t<dog>string</dog>\n</aliens>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "array",
|
type: "array",
|
||||||
items: {
|
items: {
|
||||||
type: "array",
|
type: "array",
|
||||||
@@ -698,8 +698,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("return correct nested wrapped array with xml", function () {
|
it("return correct nested wrapped array with xml", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens>\n\t<dogs>\n\t\t<dog>string</dog>\n\t</dogs>\n</aliens>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens>\n\t<dogs>\n\t\t<dog>string</dog>\n\t</dogs>\n</aliens>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "array",
|
type: "array",
|
||||||
items: {
|
items: {
|
||||||
type: "array",
|
type: "array",
|
||||||
@@ -724,8 +724,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("adds namespace to array", function () {
|
it("adds namespace to array", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<dog xmlns=\"test\">string</dog>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<dog xmlns=\"test\">string</dog>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "array",
|
type: "array",
|
||||||
items: {
|
items: {
|
||||||
type: "string",
|
type: "string",
|
||||||
@@ -744,8 +744,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("adds prefix to array", function () {
|
it("adds prefix to array", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test:dog>string</test:dog>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test:dog>string</test:dog>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "array",
|
type: "array",
|
||||||
items: {
|
items: {
|
||||||
type: "string",
|
type: "string",
|
||||||
@@ -764,8 +764,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("adds prefix to array with no xml in items", function () {
|
it("adds prefix to array with no xml in items", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test:dog>string</test:dog>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test:dog>string</test:dog>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "array",
|
type: "array",
|
||||||
items: {
|
items: {
|
||||||
type: "string"
|
type: "string"
|
||||||
@@ -780,8 +780,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("adds namespace to array with no xml in items", function () {
|
it("adds namespace to array with no xml in items", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<dog xmlns=\"test\">string</dog>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<dog xmlns=\"test\">string</dog>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "array",
|
type: "array",
|
||||||
items: {
|
items: {
|
||||||
type: "string"
|
type: "string"
|
||||||
@@ -796,8 +796,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("adds namespace to array with wrapped", function () {
|
it("adds namespace to array with wrapped", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens xmlns=\"test\">\n\t<dog>string</dog>\n</aliens>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens xmlns=\"test\">\n\t<dog>string</dog>\n</aliens>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "array",
|
type: "array",
|
||||||
items: {
|
items: {
|
||||||
type: "string",
|
type: "string",
|
||||||
@@ -816,8 +816,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("adds prefix to array with wrapped", function () {
|
it("adds prefix to array with wrapped", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test:aliens>\n\t<dog>string</dog>\n</test:aliens>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test:aliens>\n\t<dog>string</dog>\n</test:aliens>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "array",
|
type: "array",
|
||||||
items: {
|
items: {
|
||||||
type: "string",
|
type: "string",
|
||||||
@@ -836,8 +836,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns wrapped array when type is not passed", function () {
|
it("returns wrapped array when type is not passed", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>string</animal>\n</animals>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>string</animal>\n</animals>"
|
||||||
var definition = {
|
let definition = {
|
||||||
items: {
|
items: {
|
||||||
type: "string",
|
type: "string",
|
||||||
xml: {
|
xml: {
|
||||||
@@ -854,8 +854,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns array with default values", function () {
|
it("returns array with default values", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animal>one</animal>\n<animal>two</animal>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animal>one</animal>\n<animal>two</animal>"
|
||||||
var definition = {
|
let definition = {
|
||||||
items: {
|
items: {
|
||||||
type: "string",
|
type: "string",
|
||||||
xml: {
|
xml: {
|
||||||
@@ -872,8 +872,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns array with default values with wrapped=true", function () {
|
it("returns array with default values with wrapped=true", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>one</animal>\n\t<animal>two</animal>\n</animals>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>one</animal>\n\t<animal>two</animal>\n</animals>"
|
||||||
var definition = {
|
let definition = {
|
||||||
items: {
|
items: {
|
||||||
type: "string",
|
type: "string",
|
||||||
xml: {
|
xml: {
|
||||||
@@ -891,8 +891,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns array with default values", function () {
|
it("returns array with default values", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animal>one</animal>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animal>one</animal>"
|
||||||
var definition = {
|
let definition = {
|
||||||
items: {
|
items: {
|
||||||
type: "string",
|
type: "string",
|
||||||
"enum": ["one", "two"],
|
"enum": ["one", "two"],
|
||||||
@@ -909,8 +909,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns array with default values with wrapped=true", function () {
|
it("returns array with default values with wrapped=true", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>1</animal>\n\t<animal>2</animal>\n</animals>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>1</animal>\n\t<animal>2</animal>\n</animals>"
|
||||||
var definition = {
|
let definition = {
|
||||||
items: {
|
items: {
|
||||||
"enum": ["one", "two"],
|
"enum": ["one", "two"],
|
||||||
type: "string",
|
type: "string",
|
||||||
@@ -929,8 +929,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns array with example values with ", function () {
|
it("returns array with example values with ", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>1</animal>\n\t<animal>2</animal>\n</animals>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>1</animal>\n\t<animal>2</animal>\n</animals>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
"animal": {
|
"animal": {
|
||||||
@@ -953,8 +953,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns array with example values with wrapped=true", function () {
|
it("returns array with example values with wrapped=true", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>1</animal>\n\t<animal>2</animal>\n</animals>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>1</animal>\n\t<animal>2</animal>\n</animals>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "array",
|
type: "array",
|
||||||
items: {
|
items: {
|
||||||
type: "string",
|
type: "string",
|
||||||
@@ -973,8 +973,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns array of objects with example values with wrapped=true", function () {
|
it("returns array of objects with example values with wrapped=true", function () {
|
||||||
var expected = `<?xml version="1.0" encoding="UTF-8"?>\n<users>\n\t<user>\n\t\t<id>1</id>\n\t\t<name>Arthur Dent</name>\n\t</user>\n\t<user>\n\t\t<id>2</id>\n\t\t<name>Ford Prefect</name>\n\t</user>\n</users>`
|
let expected = `<?xml version="1.0" encoding="UTF-8"?>\n<users>\n\t<user>\n\t\t<id>1</id>\n\t\t<name>Arthur Dent</name>\n\t</user>\n\t<user>\n\t\t<id>2</id>\n\t\t<name>Ford Prefect</name>\n\t</user>\n</users>`
|
||||||
var definition = {
|
let definition = {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
@@ -1013,8 +1013,8 @@ describe("createXMLExample", function () {
|
|||||||
|
|
||||||
describe("object", function () {
|
describe("object", function () {
|
||||||
it("returns object with 2 properties", function () {
|
it("returns object with 2 properties", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens>\n\t<alien>string</alien>\n\t<dog>0</dog>\n</aliens>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens>\n\t<alien>string</alien>\n\t<dog>0</dog>\n</aliens>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
alien: {
|
alien: {
|
||||||
@@ -1033,8 +1033,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns object with integer property and array property", function () {
|
it("returns object with integer property and array property", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<aliens>string</aliens>\n\t<dog>0</dog>\n</animals>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<aliens>string</aliens>\n\t<dog>0</dog>\n</animals>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
aliens: {
|
aliens: {
|
||||||
@@ -1056,8 +1056,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns nested objects", function () {
|
it("returns nested objects", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<aliens>\n\t\t<alien>string</alien>\n\t</aliens>\n\t<dog>string</dog>\n</animals>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<aliens>\n\t\t<alien>string</alien>\n\t</aliens>\n\t<dog>string</dog>\n</animals>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
aliens: {
|
aliens: {
|
||||||
@@ -1084,8 +1084,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns object with no readonly fields for parameter", function () {
|
it("returns object with no readonly fields for parameter", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<id>0</id>\n</animals>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<id>0</id>\n</animals>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
id: {
|
id: {
|
||||||
@@ -1105,8 +1105,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns object with readonly fields for parameter, with includeReadOnly", function () {
|
it("returns object with readonly fields for parameter, with includeReadOnly", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<id>0</id>\n\t<dog>string</dog>\n</animals>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<id>0</id>\n\t<dog>string</dog>\n</animals>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
id: {
|
id: {
|
||||||
@@ -1126,8 +1126,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns object without writeonly fields for parameter", function () {
|
it("returns object without writeonly fields for parameter", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<id>0</id>\n</animals>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<id>0</id>\n</animals>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
id: {
|
id: {
|
||||||
@@ -1147,8 +1147,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns object with writeonly fields for parameter, with includeWriteOnly", function () {
|
it("returns object with writeonly fields for parameter, with includeWriteOnly", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<id>0</id>\n\t<dog>string</dog>\n</animals>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<id>0</id>\n\t<dog>string</dog>\n</animals>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
id: {
|
id: {
|
||||||
@@ -1168,8 +1168,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns object with passed property as attribute", function () {
|
it("returns object with passed property as attribute", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals id=\"0\">\n\t<dog>string</dog>\n</animals>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals id=\"0\">\n\t<dog>string</dog>\n</animals>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
id: {
|
id: {
|
||||||
@@ -1191,8 +1191,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns object with passed property as attribute with custom name", function () {
|
it("returns object with passed property as attribute with custom name", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals test=\"0\">\n\t<dog>string</dog>\n</animals>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals test=\"0\">\n\t<dog>string</dog>\n</animals>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
id: {
|
id: {
|
||||||
@@ -1215,8 +1215,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns object with example values in attribute", function () {
|
it("returns object with example values in attribute", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user id=\"42\">\n\t<role>admin</role>\n</user>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user id=\"42\">\n\t<role>admin</role>\n</user>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
id: {
|
id: {
|
||||||
@@ -1242,8 +1242,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns object with enum values in attribute", function () {
|
it("returns object with enum values in attribute", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user id=\"one\">\n\t<role>string</role>\n</user>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user id=\"one\">\n\t<role>string</role>\n</user>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
id: {
|
id: {
|
||||||
@@ -1266,8 +1266,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns object with default values in attribute", function () {
|
it("returns object with default values in attribute", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user id=\"one\">\n\t<role>string</role>\n</user>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user id=\"one\">\n\t<role>string</role>\n</user>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
id: {
|
id: {
|
||||||
@@ -1290,8 +1290,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns object with default values in attribute", function () {
|
it("returns object with default values in attribute", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user id=\"one\">\n\t<role>string</role>\n</user>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user id=\"one\">\n\t<role>string</role>\n</user>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
id: {
|
id: {
|
||||||
@@ -1314,8 +1314,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns object with example value", function () {
|
it("returns object with example value", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user>\n\t<id>42</id>\n\t<role>admin</role>\n</user>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user>\n\t<id>42</id>\n\t<role>admin</role>\n</user>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
id: {
|
id: {
|
||||||
@@ -1338,8 +1338,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns object with additional props", function () {
|
it("returns object with additional props", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<dog>string</dog>\n\t<additionalProp>string</additionalProp>\n</animals>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<dog>string</dog>\n\t<additionalProp>string</additionalProp>\n</animals>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
dog: {
|
dog: {
|
||||||
@@ -1358,8 +1358,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns object with additional props =true", function () {
|
it("returns object with additional props =true", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<dog>string</dog>\n\t<additionalProp>Anything can be here</additionalProp>\n</animals>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<dog>string</dog>\n\t<additionalProp>Anything can be here</additionalProp>\n</animals>"
|
||||||
var definition = {
|
let definition = {
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
dog: {
|
dog: {
|
||||||
@@ -1376,8 +1376,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns object with 2 properties with no type passed but properties", function () {
|
it("returns object with 2 properties with no type passed but properties", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens>\n\t<alien>string</alien>\n\t<dog>0</dog>\n</aliens>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens>\n\t<alien>string</alien>\n\t<dog>0</dog>\n</aliens>"
|
||||||
var definition = {
|
let definition = {
|
||||||
properties: {
|
properties: {
|
||||||
alien: {
|
alien: {
|
||||||
type: "string"
|
type: "string"
|
||||||
@@ -1395,8 +1395,8 @@ describe("createXMLExample", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("returns object with additional props with no type passed", function () {
|
it("returns object with additional props with no type passed", function () {
|
||||||
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<additionalProp>string</additionalProp>\n</animals>"
|
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<additionalProp>string</additionalProp>\n</animals>"
|
||||||
var definition = {
|
let definition = {
|
||||||
additionalProperties: {
|
additionalProperties: {
|
||||||
type: "string"
|
type: "string"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ describe("bound system", function(){
|
|||||||
})
|
})
|
||||||
|
|
||||||
// When
|
// When
|
||||||
var action = system.getSystem().joshActions.simple(1)
|
let action = system.getSystem().joshActions.simple(1)
|
||||||
expect(action).toEqual({
|
expect(action).toEqual({
|
||||||
type: "newSimple"
|
type: "newSimple"
|
||||||
})
|
})
|
||||||
@@ -65,7 +65,7 @@ describe("bound system", function(){
|
|||||||
})
|
})
|
||||||
|
|
||||||
// When
|
// When
|
||||||
var action = system.getSystem().joshActions.simple(1)
|
let action = system.getSystem().joshActions.simple(1)
|
||||||
expect(action).toEqual({
|
expect(action).toEqual({
|
||||||
type: "newSimple",
|
type: "newSimple",
|
||||||
oriActionResult: { type: "simple" },
|
oriActionResult: { type: "simple" },
|
||||||
@@ -123,7 +123,7 @@ describe("bound system", function(){
|
|||||||
})
|
})
|
||||||
|
|
||||||
// When
|
// When
|
||||||
var action = system.getSystem().kyleActions.simple(1)
|
let action = system.getSystem().kyleActions.simple(1)
|
||||||
expect(action).toEqual({
|
expect(action).toEqual({
|
||||||
type: "simple",
|
type: "simple",
|
||||||
firstWrap: true,
|
firstWrap: true,
|
||||||
@@ -178,7 +178,7 @@ describe("bound system", function(){
|
|||||||
})
|
})
|
||||||
|
|
||||||
// When
|
// When
|
||||||
var action = system.getSystem().kyleActions.simple(1)
|
let action = system.getSystem().kyleActions.simple(1)
|
||||||
expect(action.type).toEqual("one-two-three")
|
expect(action.type).toEqual("one-two-three")
|
||||||
|
|
||||||
})
|
})
|
||||||
@@ -257,7 +257,7 @@ describe("bound system", function(){
|
|||||||
})
|
})
|
||||||
|
|
||||||
// When
|
// When
|
||||||
var action = system.getSystem().kyleActions.simple(1)
|
let action = system.getSystem().kyleActions.simple(1)
|
||||||
expect(action.type).toEqual("called")
|
expect(action.type).toEqual("called")
|
||||||
|
|
||||||
})
|
})
|
||||||
@@ -307,7 +307,7 @@ describe("bound system", function(){
|
|||||||
})
|
})
|
||||||
|
|
||||||
// When
|
// When
|
||||||
var res = system.getSystem().joshSelectors.simple(1)
|
let res = system.getSystem().joshSelectors.simple(1)
|
||||||
expect(res).toEqual({
|
expect(res).toEqual({
|
||||||
state: fromJS({
|
state: fromJS({
|
||||||
one: 1
|
one: 1
|
||||||
@@ -340,7 +340,7 @@ describe("bound system", function(){
|
|||||||
})
|
})
|
||||||
|
|
||||||
// When
|
// When
|
||||||
var res = system.getSystem().joshSelectors.advanced(1)
|
let res = system.getSystem().joshSelectors.advanced(1)
|
||||||
expect(res).toEqual("hi")
|
expect(res).toEqual("hi")
|
||||||
|
|
||||||
})
|
})
|
||||||
@@ -380,7 +380,7 @@ describe("bound system", function(){
|
|||||||
})
|
})
|
||||||
|
|
||||||
// When
|
// When
|
||||||
var res = system.getSystem().dogeSelectors.wow(1)
|
let res = system.getSystem().dogeSelectors.wow(1)
|
||||||
expect(res).toEqual("original wrapper")
|
expect(res).toEqual("original wrapper")
|
||||||
|
|
||||||
})
|
})
|
||||||
@@ -479,7 +479,7 @@ describe("bound system", function(){
|
|||||||
})
|
})
|
||||||
|
|
||||||
// When
|
// When
|
||||||
var Component = system.getSystem().getComponent("test")
|
let Component = system.getSystem().getComponent("test")
|
||||||
const renderedComponent = render(<Component name="Test" />)
|
const renderedComponent = render(<Component name="Test" />)
|
||||||
expect(renderedComponent.text()).toEqual("Test component")
|
expect(renderedComponent.text()).toEqual("Test component")
|
||||||
})
|
})
|
||||||
@@ -525,7 +525,7 @@ describe("bound system", function(){
|
|||||||
})
|
})
|
||||||
|
|
||||||
// When
|
// When
|
||||||
var Component = system.getSystem().getComponent("ContainerComponent", true)
|
let Component = system.getSystem().getComponent("ContainerComponent", true)
|
||||||
const renderedComponent = render(
|
const renderedComponent = render(
|
||||||
<Provider store={system.getStore()}>
|
<Provider store={system.getStore()}>
|
||||||
<Component fromOwnProps="and this came from my own props" />
|
<Component fromOwnProps="and this came from my own props" />
|
||||||
@@ -578,7 +578,7 @@ describe("bound system", function(){
|
|||||||
})
|
})
|
||||||
|
|
||||||
// When
|
// When
|
||||||
var Component = system.getSystem().getComponent("ContainerComponent", true)
|
let Component = system.getSystem().getComponent("ContainerComponent", true)
|
||||||
const renderedComponent = render(
|
const renderedComponent = render(
|
||||||
<Provider store={system.getStore()}>
|
<Provider store={system.getStore()}>
|
||||||
<Component fromOwnProps="and this came from my own props" />
|
<Component fromOwnProps="and this came from my own props" />
|
||||||
@@ -613,7 +613,7 @@ describe("bound system", function(){
|
|||||||
})
|
})
|
||||||
|
|
||||||
// When
|
// When
|
||||||
var res = system.getSystem().wow()
|
let res = system.getSystem().wow()
|
||||||
expect(res).toEqual("so selective")
|
expect(res).toEqual("so selective")
|
||||||
})
|
})
|
||||||
it("should call a preset plugin's `afterLoad` method after the plugin is loaded", function() {
|
it("should call a preset plugin's `afterLoad` method after the plugin is loaded", function() {
|
||||||
@@ -640,7 +640,7 @@ describe("bound system", function(){
|
|||||||
})
|
})
|
||||||
|
|
||||||
// When
|
// When
|
||||||
var res = system.getSystem().wow()
|
let res = system.getSystem().wow()
|
||||||
expect(res).toEqual("so selective")
|
expect(res).toEqual("so selective")
|
||||||
})
|
})
|
||||||
it("should call a function preset plugin's `afterLoad` method after the plugin is loaded", function() {
|
it("should call a function preset plugin's `afterLoad` method after the plugin is loaded", function() {
|
||||||
@@ -669,7 +669,7 @@ describe("bound system", function(){
|
|||||||
})
|
})
|
||||||
|
|
||||||
// When
|
// When
|
||||||
var res = system.getSystem().wow()
|
let res = system.getSystem().wow()
|
||||||
expect(res).toEqual("so selective")
|
expect(res).toEqual("so selective")
|
||||||
})
|
})
|
||||||
it("should call a registered plugin's `afterLoad` method after the plugin is loaded", function() {
|
it("should call a registered plugin's `afterLoad` method after the plugin is loaded", function() {
|
||||||
@@ -696,7 +696,7 @@ describe("bound system", function(){
|
|||||||
system.register([MyPlugin])
|
system.register([MyPlugin])
|
||||||
|
|
||||||
// When
|
// When
|
||||||
var res = system.getSystem().wow()
|
let res = system.getSystem().wow()
|
||||||
expect(res).toEqual("so selective")
|
expect(res).toEqual("so selective")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -726,7 +726,7 @@ describe("bound system", function(){
|
|||||||
})
|
})
|
||||||
|
|
||||||
// When
|
// When
|
||||||
var res = system.getSystem().wow()
|
let res = system.getSystem().wow()
|
||||||
expect(res).toEqual("so selective")
|
expect(res).toEqual("so selective")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -757,7 +757,7 @@ describe("bound system", function(){
|
|||||||
// When
|
// When
|
||||||
expect(function() {
|
expect(function() {
|
||||||
system.register([ThrowyPlugin])
|
system.register([ThrowyPlugin])
|
||||||
// var resSystem = system.getSystem()
|
// let resSystem = system.getSystem()
|
||||||
}).toNotThrow()
|
}).toNotThrow()
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -934,7 +934,7 @@ describe("bound system", function(){
|
|||||||
})
|
})
|
||||||
|
|
||||||
// When
|
// When
|
||||||
var Component = system.getSystem().getComponent("BrokenComponent")
|
let Component = system.getSystem().getComponent("BrokenComponent")
|
||||||
const renderedComponent = render(<Component />)
|
const renderedComponent = render(<Component />)
|
||||||
|
|
||||||
// Then
|
// Then
|
||||||
@@ -962,7 +962,7 @@ describe("bound system", function(){
|
|||||||
})
|
})
|
||||||
|
|
||||||
// When
|
// When
|
||||||
var Component = system.getSystem().getComponent("BrokenComponent")
|
let Component = system.getSystem().getComponent("BrokenComponent")
|
||||||
const renderedComponent = render(<Component />)
|
const renderedComponent = render(<Component />)
|
||||||
|
|
||||||
// Then
|
// Then
|
||||||
@@ -985,7 +985,7 @@ describe("bound system", function(){
|
|||||||
})
|
})
|
||||||
|
|
||||||
// When
|
// When
|
||||||
var Component = system.getSystem().getComponent("BrokenComponent")
|
let Component = system.getSystem().getComponent("BrokenComponent")
|
||||||
const renderedComponent = render(<Component />)
|
const renderedComponent = render(<Component />)
|
||||||
|
|
||||||
// Then
|
// Then
|
||||||
@@ -1013,7 +1013,7 @@ describe("bound system", function(){
|
|||||||
})
|
})
|
||||||
|
|
||||||
// When
|
// When
|
||||||
var Component = system.getSystem().getComponent("BrokenComponent", true)
|
let Component = system.getSystem().getComponent("BrokenComponent", true)
|
||||||
const renderedComponent = render(
|
const renderedComponent = render(
|
||||||
<Provider store={system.getStore()}>
|
<Provider store={system.getStore()}>
|
||||||
<Component />
|
<Component />
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ describe("wrapComponents", () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// When
|
// When
|
||||||
var Component = system.getSystem().getComponents("wow")
|
let Component = system.getSystem().getComponents("wow")
|
||||||
const wrapper = render(<Component name="Normal" />)
|
const wrapper = render(<Component name="Normal" />)
|
||||||
|
|
||||||
const container = wrapper.children().first()
|
const container = wrapper.children().first()
|
||||||
@@ -73,7 +73,7 @@ describe("wrapComponents", () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// When
|
// When
|
||||||
var Component = system.getSystem().getComponents("wow")
|
let Component = system.getSystem().getComponents("wow")
|
||||||
const wrapper = render(<Component name="Normal" />)
|
const wrapper = render(<Component name="Normal" />)
|
||||||
|
|
||||||
const container = wrapper.children().first()
|
const container = wrapper.children().first()
|
||||||
@@ -125,7 +125,7 @@ describe("wrapComponents", () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Then
|
// Then
|
||||||
var Component = mySystem.getSystem().getComponents("wow")
|
let Component = mySystem.getSystem().getComponents("wow")
|
||||||
const wrapper = render(<Component name="Normal" />)
|
const wrapper = render(<Component name="Normal" />)
|
||||||
|
|
||||||
const container = wrapper.children().first()
|
const container = wrapper.children().first()
|
||||||
@@ -179,7 +179,7 @@ describe("wrapComponents", () => {
|
|||||||
])
|
])
|
||||||
|
|
||||||
// Then
|
// Then
|
||||||
var Component = mySystem.getSystem().getComponents("wow")
|
let Component = mySystem.getSystem().getComponents("wow")
|
||||||
const wrapper = render(<Component name="Normal" />)
|
const wrapper = render(<Component name="Normal" />)
|
||||||
|
|
||||||
const container = wrapper.children().first()
|
const container = wrapper.children().first()
|
||||||
@@ -233,7 +233,7 @@ describe("wrapComponents", () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Then
|
// Then
|
||||||
var Component = secondSystem.getSystem().getComponents("wow")
|
let Component = secondSystem.getSystem().getComponents("wow")
|
||||||
const wrapper = render(<Component name="Normal" />)
|
const wrapper = render(<Component name="Normal" />)
|
||||||
|
|
||||||
const container = wrapper.children().first()
|
const container = wrapper.children().first()
|
||||||
|
|||||||
Reference in New Issue
Block a user