Browse Source

style: replace var with let in /test files (#6164)

bubble
Tim Lai 4 years ago
committed by GitHub
parent
commit
a1589a679c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 204 additions and 204 deletions
  1. +8
    -8
      test/e2e-cypress/helpers/oauth2-server/index.js
  2. +15
    -15
      test/e2e-cypress/helpers/oauth2-server/model.js
  3. +16
    -16
      test/mocha/core/curlify.js
  4. +139
    -139
      test/mocha/core/plugins/samples/fn.js
  5. +21
    -21
      test/mocha/core/system/system.jsx
  6. +5
    -5
      test/mocha/core/system/wrapComponent.jsx

+ 8
- 8
test/e2e-cypress/helpers/oauth2-server/index.js View File

@@ -1,13 +1,13 @@
// from https://github.com/pedroetb/node-oauth2-server-example

var Http = require("http")
var path = require("path")
var express = require("express")
var bodyParser = require("body-parser")
var oauthserver = require("oauth2-server")
var cors = require("cors")
let Http = require("http")
let path = require("path")
let express = require("express")
let bodyParser = require("body-parser")
let oauthserver = require("oauth2-server")
let cors = require("cors")

var app = express()
let app = express()

app.use(cors())

@@ -34,7 +34,7 @@ app.get("*", app.oauth.authorise(), function (req, res) {
app.use(app.oauth.errorHandler())

function startServer() {
var httpServer = Http.createServer(app)
let httpServer = Http.createServer(app)
httpServer.listen("3231")

return function stopServer() {


+ 15
- 15
test/e2e-cypress/helpers/oauth2-server/model.js View File

@@ -1,6 +1,6 @@
// from https://github.com/pedroetb/node-oauth2-server-example

var config = {
let config = {
clients: [{
clientId: "application",
clientSecret: "secret"
@@ -21,7 +21,7 @@ var config = {
* Dump the memory storage content (for debug).
*/

var dump = function () {
let dump = function () {

console.log("clients", config.clients)
console.log("confidentialClients", config.confidentialClients)
@@ -33,9 +33,9 @@ var dump = function () {
* 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
})
@@ -43,14 +43,14 @@ var getAccessToken = function (bearerToken, callback) {
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
})

var confidentialClients = config.confidentialClients.filter(function (client) {
let confidentialClients = config.confidentialClients.filter(function (client) {

return client.clientId === clientId && client.clientSecret === clientSecret
})
@@ -58,9 +58,9 @@ var getClient = function (clientId, clientSecret, callback) {
callback(false, clients[0] || confidentialClients[0])
}

var grantTypeAllowed = function (clientId, grantType, callback) {
let grantTypeAllowed = function (clientId, grantType, callback) {

var clientsSource,
let clientsSource,
clients = []

if (grantType === "password") {
@@ -79,7 +79,7 @@ var grantTypeAllowed = function (clientId, grantType, callback) {
callback(false, clients.length)
}

var saveAccessToken = function (accessToken, clientId, expires, user, callback) {
let saveAccessToken = function (accessToken, clientId, expires, user, callback) {

config.tokens.push({
accessToken: accessToken,
@@ -95,9 +95,9 @@ var saveAccessToken = function (accessToken, clientId, expires, user, callback)
* 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
})
@@ -109,14 +109,14 @@ var getUser = function (username, password, callback) {
* 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
})

var user
let user

if (clients.length) {
user = {


+ 16
- 16
test/mocha/core/curlify.js View File

@@ -6,7 +6,7 @@ import win from "core/window"
describe("curlify", function () {

it("prints a curl statement with custom content-type", function () {
var req = {
let req = {
url: "http://example.com",
method: "POST",
body: {
@@ -26,7 +26,7 @@ describe("curlify", function () {
})

it("does add a empty data param if no request body given", function () {
var req = {
let req = {
url: "http://example.com",
method: "POST",
}
@@ -37,7 +37,7 @@ describe("curlify", function () {
})

it("does not change the case of header in curl", function () {
var req = {
let req = {
url: "http://example.com",
method: "POST",
headers: {
@@ -51,7 +51,7 @@ describe("curlify", 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",
method: "GET"
}
@@ -62,7 +62,7 @@ describe("curlify", 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",
method: "GET",
headers: {
@@ -76,7 +76,7 @@ describe("curlify", function () {
})

it("prints a curl statement with html", function () {
var req = {
let req = {
url: "http://swaggerhub.com/v1/one?name=john|smith",
method: "GET",
headers: {
@@ -93,7 +93,7 @@ describe("curlify", function () {
})

it("handles post body with html", function () {
var req = {
let req = {
url: "http://swaggerhub.com/v1/one?name=john|smith",
method: "POST",
headers: {
@@ -110,7 +110,7 @@ describe("curlify", function () {
})

it("handles post body with special chars", function () {
var req = {
let req = {
url: "http://swaggerhub.com/v1/one?name=john|smith",
method: "POST",
body: {
@@ -125,7 +125,7 @@ describe("curlify", function () {
})

it("handles delete form with parameters", function () {
var req = {
let req = {
url: "http://example.com",
method: "DELETE",
headers: {
@@ -139,7 +139,7 @@ describe("curlify", function () {
})

it("should print a curl with formData", function () {
var req = {
let req = {
url: "http://example.com",
method: "POST",
headers: { "content-type": "multipart/form-data" },
@@ -175,11 +175,11 @@ describe("curlify", 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.type = "text/plain"

var req = {
let req = {
url: "http://example.com",
method: "POST",
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 () {
var file = new win.File()
let file = new win.File()
file.name = "file.txt"
file.type = ""

var req = {
let req = {
url: "http://example.com",
method: "POST",
headers: { "content-type": "multipart/form-data" },
@@ -215,7 +215,7 @@ describe("curlify", function () {
})

it("prints a curl post statement from an object", function () {
var req = {
let req = {
url: "http://example.com",
method: "POST",
headers: {
@@ -232,7 +232,7 @@ describe("curlify", function () {
})

it("prints a curl post statement from a string containing a single quote", function () {
var req = {
let req = {
url: "http://example.com",
method: "POST",
headers: {


+ 139
- 139
test/mocha/core/plugins/samples/fn.js View File

@@ -4,7 +4,7 @@ import expect from "expect"

describe("sampleFromSchema", function() {
it("handles Immutable.js objects for nested schemas", function () {
var definition = fromJS({
let definition = fromJS({
"type": "object",
"properties": {
"json": {
@@ -21,7 +21,7 @@ describe("sampleFromSchema", function() {
}
})

var expected = {
let expected = {
json: {
a: "string"
}
@@ -31,7 +31,7 @@ describe("sampleFromSchema", function() {
})

it("returns object with no readonly fields for parameter", function () {
var definition = {
let definition = {
type: "object",
properties: {
id: {
@@ -47,7 +47,7 @@ describe("sampleFromSchema", function() {
}
}

var expected = {
let expected = {
id: 0
}

@@ -55,7 +55,7 @@ describe("sampleFromSchema", function() {
})

it("returns object with readonly fields for parameter, with includeReadOnly", function () {
var definition = {
let definition = {
type: "object",
properties: {
id: {
@@ -71,7 +71,7 @@ describe("sampleFromSchema", function() {
}
}

var expected = {
let expected = {
id: 0,
readOnlyDog: "string"
}
@@ -80,7 +80,7 @@ describe("sampleFromSchema", function() {
})

it("returns object without deprecated fields for parameter", function () {
var definition = {
let definition = {
type: "object",
properties: {
id: {
@@ -96,7 +96,7 @@ describe("sampleFromSchema", function() {
}
}

var expected = {
let expected = {
id: 0
}

@@ -104,7 +104,7 @@ describe("sampleFromSchema", function() {
})

it("returns object without writeonly fields for parameter", function () {
var definition = {
let definition = {
type: "object",
properties: {
id: {
@@ -120,7 +120,7 @@ describe("sampleFromSchema", function() {
}
}

var expected = {
let expected = {
id: 0
}

@@ -128,7 +128,7 @@ describe("sampleFromSchema", function() {
})

it("returns object with writeonly fields for parameter, with includeWriteOnly", function () {
var definition = {
let definition = {
type: "object",
properties: {
id: {
@@ -144,7 +144,7 @@ describe("sampleFromSchema", function() {
}
}

var expected = {
let expected = {
id: 0,
writeOnlyDog: "string"
}
@@ -153,7 +153,7 @@ describe("sampleFromSchema", function() {
})

it("returns object without any $$ref fields at the root schema level", function () {
var definition = {
let definition = {
type: "object",
properties: {
message: {
@@ -169,7 +169,7 @@ describe("sampleFromSchema", function() {
$$ref: "#/components/schemas/Welcome"
}

var expected = {
let expected = {
"value": {
"message": "Hello, World!"
}
@@ -179,7 +179,7 @@ describe("sampleFromSchema", function() {
})

it("returns object without any $$ref fields at nested schema levels", function () {
var definition = {
let definition = {
type: "object",
properties: {
message: {
@@ -197,7 +197,7 @@ describe("sampleFromSchema", function() {
$$ref: "#/components/schemas/Welcome"
}

var expected = {
let expected = {
a: {
"value": {
"message": "Hello, World!"
@@ -209,7 +209,7 @@ describe("sampleFromSchema", function() {
})

it("returns object with any $$ref fields that appear to be user-created", function () {
var definition = {
let definition = {
type: "object",
properties: {
message: {
@@ -227,7 +227,7 @@ describe("sampleFromSchema", function() {
$$ref: "#/components/schemas/Welcome"
}

var expected = {
let expected = {
$$ref: {
"value": {
"message": "Hello, World!"
@@ -239,7 +239,7 @@ describe("sampleFromSchema", function() {
})

it("returns example value for date-time property", function() {
var definition = {
let definition = {
type: "string",
format: "date-time"
}
@@ -247,82 +247,82 @@ describe("sampleFromSchema", function() {
// 0-20 chops off milliseconds
// necessary because test latency can cause failures
// 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)
})

it("returns example value for date property", function() {
var definition = {
let definition = {
type: "string",
format: "date"
}

var expected = new Date().toISOString().substring(0, 10)
let expected = new Date().toISOString().substring(0, 10)

expect(sampleFromSchema(definition)).toEqual(expected)
})

it("returns a UUID for a string with format=uuid", function() {
var definition = {
let definition = {
type: "string",
format: "uuid"
}

var expected = "3fa85f64-5717-4562-b3fc-2c963f66afa6"
let expected = "3fa85f64-5717-4562-b3fc-2c963f66afa6"

expect(sampleFromSchema(definition)).toEqual(expected)
})

it("returns a hostname for a string with format=hostname", function() {
var definition = {
let definition = {
type: "string",
format: "hostname"
}

var expected = "example.com"
let expected = "example.com"

expect(sampleFromSchema(definition)).toEqual(expected)
})

it("returns an IPv4 address for a string with format=ipv4", function() {
var definition = {
let definition = {
type: "string",
format: "ipv4"
}

var expected = "198.51.100.42"
let expected = "198.51.100.42"

expect(sampleFromSchema(definition)).toEqual(expected)
})

it("returns an IPv6 address for a string with format=ipv6", function() {
var definition = {
let definition = {
type: "string",
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)
})

describe("for array type", function() {
it("returns array with sample of array type", function() {
var definition = {
let definition = {
type: "array",
items: {
type: "integer"
}
}

var expected = [ 0 ]
let expected = [ 0 ]

expect(sampleFromSchema(definition)).toEqual(expected)
})

it("returns array of examples for array that has example", function() {
var definition = {
let definition = {
type: "array",
items: {
type: "string"
@@ -330,13 +330,13 @@ describe("sampleFromSchema", function() {
example: "dog"
}

var expected = [ "dog" ]
let expected = [ "dog" ]

expect(sampleFromSchema(definition)).toEqual(expected)
})

it("returns array of examples for array that has examples", function() {
var definition = {
let definition = {
type: "array",
items: {
type: "string",
@@ -344,13 +344,13 @@ describe("sampleFromSchema", function() {
example: [ "dog", "cat" ]
}

var expected = [ "dog", "cat" ]
let expected = [ "dog", "cat" ]

expect(sampleFromSchema(definition)).toEqual(expected)
})

it("returns array of samples for oneOf type", function() {
var definition = {
let definition = {
type: "array",
items: {
type: "string",
@@ -362,13 +362,13 @@ describe("sampleFromSchema", function() {
}
}

var expected = [ 0 ]
let expected = [ 0 ]

expect(sampleFromSchema(definition)).toEqual(expected)
})

it("returns array of samples for oneOf types", function() {
var definition = {
let definition = {
type: "array",
items: {
type: "string",
@@ -383,13 +383,13 @@ describe("sampleFromSchema", function() {
}
}

var expected = [ "string", 0 ]
let expected = [ "string", 0 ]

expect(sampleFromSchema(definition)).toEqual(expected)
})

it("returns array of samples for oneOf examples", function() {
var definition = {
let definition = {
type: "array",
items: {
type: "string",
@@ -406,13 +406,13 @@ describe("sampleFromSchema", function() {
}
}

var expected = [ "dog", 1 ]
let expected = [ "dog", 1 ]

expect(sampleFromSchema(definition)).toEqual(expected)
})

it("returns array of samples for anyOf type", function() {
var definition = {
let definition = {
type: "array",
items: {
type: "string",
@@ -424,13 +424,13 @@ describe("sampleFromSchema", function() {
}
}

var expected = [ 0 ]
let expected = [ 0 ]

expect(sampleFromSchema(definition)).toEqual(expected)
})

it("returns array of samples for anyOf types", function() {
var definition = {
let definition = {
type: "array",
items: {
type: "string",
@@ -445,13 +445,13 @@ describe("sampleFromSchema", function() {
}
}

var expected = [ "string", 0 ]
let expected = [ "string", 0 ]

expect(sampleFromSchema(definition)).toEqual(expected)
})

it("returns array of samples for anyOf examples", function() {
var definition = {
let definition = {
type: "array",
items: {
type: "string",
@@ -468,13 +468,13 @@ describe("sampleFromSchema", function() {
}
}

var expected = [ "dog", 1 ]
let expected = [ "dog", 1 ]

expect(sampleFromSchema(definition)).toEqual(expected)
})

it("returns null for a null example", function() {
var definition = {
let definition = {
"type": "object",
"properties": {
"foo": {
@@ -485,7 +485,7 @@ describe("sampleFromSchema", function() {
}
}

var expected = {
let expected = {
foo: null
}

@@ -493,7 +493,7 @@ describe("sampleFromSchema", function() {
})

it("returns null for a null object-level example", function() {
var definition = {
let definition = {
"type": "object",
"properties": {
"foo": {
@@ -506,7 +506,7 @@ describe("sampleFromSchema", function() {
}
}

var expected = {
let expected = {
foo: null
}

@@ -516,10 +516,10 @@ describe("sampleFromSchema", function() {
})

describe("createXMLExample", function () {
var sut = createXMLExample
let sut = createXMLExample
describe("simple types with xml property", function () {
it("returns tag <newtagname>string</newtagname> when passing type string and xml:{name: \"newtagname\"}", function () {
var definition = {
let definition = {
type: "string",
xml: {
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 () {
var definition = {
let definition = {
type: "string",
xml: {
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 () {
var definition = {
let definition = {
type: "string",
xml: {
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 () {
var definition = {
let definition = {
type: "string",
xml: {
namespace: "http://swagger.io/schema/sample",
@@ -567,8 +567,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<newtagname>test</newtagname>"
let definition = {
type: "string",
"default": "test",
xml: {
@@ -580,8 +580,8 @@ describe("createXMLExample", function () {
})

it("returns default value when enum provided", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<newtagname>one</newtagname>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<newtagname>one</newtagname>"
let definition = {
type: "string",
"default": "one",
"enum": ["two", "one"],
@@ -594,8 +594,8 @@ describe("createXMLExample", function () {
})

it("returns example value when provided", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<newtagname>two</newtagname>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<newtagname>two</newtagname>"
let definition = {
type: "string",
"default": "one",
"example": "two",
@@ -609,8 +609,8 @@ describe("createXMLExample", function () {
})

it("sets first enum if provided", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<newtagname>one</newtagname>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<newtagname>one</newtagname>"
let definition = {
type: "string",
"enum": ["one", "two"],
xml: {
@@ -624,8 +624,8 @@ describe("createXMLExample", function () {

describe("array", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<tagname>string</tagname>"
let definition = {
type: "array",
items: {
type: "string"
@@ -639,8 +639,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animal>string</animal>"
let definition = {
type: "array",
items: {
type: "string",
@@ -657,8 +657,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>string</animal>\n</animals>"
let definition = {
type: "array",
items: {
type: "string",
@@ -676,8 +676,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens>\n\t<dog>string</dog>\n</aliens>"
let definition = {
type: "array",
items: {
type: "array",
@@ -698,8 +698,8 @@ describe("createXMLExample", 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>"
var definition = {
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>"
let definition = {
type: "array",
items: {
type: "array",
@@ -724,8 +724,8 @@ describe("createXMLExample", function () {
})

it("adds namespace to array", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<dog xmlns=\"test\">string</dog>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<dog xmlns=\"test\">string</dog>"
let definition = {
type: "array",
items: {
type: "string",
@@ -744,8 +744,8 @@ describe("createXMLExample", function () {
})

it("adds prefix to array", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test:dog>string</test:dog>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test:dog>string</test:dog>"
let definition = {
type: "array",
items: {
type: "string",
@@ -764,8 +764,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test:dog>string</test:dog>"
let definition = {
type: "array",
items: {
type: "string"
@@ -780,8 +780,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<dog xmlns=\"test\">string</dog>"
let definition = {
type: "array",
items: {
type: "string"
@@ -796,8 +796,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens xmlns=\"test\">\n\t<dog>string</dog>\n</aliens>"
let definition = {
type: "array",
items: {
type: "string",
@@ -816,8 +816,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test:aliens>\n\t<dog>string</dog>\n</test:aliens>"
let definition = {
type: "array",
items: {
type: "string",
@@ -836,8 +836,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>string</animal>\n</animals>"
let definition = {
items: {
type: "string",
xml: {
@@ -854,8 +854,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animal>one</animal>\n<animal>two</animal>"
let definition = {
items: {
type: "string",
xml: {
@@ -872,8 +872,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>one</animal>\n\t<animal>two</animal>\n</animals>"
let definition = {
items: {
type: "string",
xml: {
@@ -891,8 +891,8 @@ describe("createXMLExample", function () {
})

it("returns array with default values", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animal>one</animal>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animal>one</animal>"
let definition = {
items: {
type: "string",
"enum": ["one", "two"],
@@ -909,8 +909,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>1</animal>\n\t<animal>2</animal>\n</animals>"
let definition = {
items: {
"enum": ["one", "two"],
type: "string",
@@ -929,8 +929,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>1</animal>\n\t<animal>2</animal>\n</animals>"
let definition = {
type: "object",
properties: {
"animal": {
@@ -953,8 +953,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>1</animal>\n\t<animal>2</animal>\n</animals>"
let definition = {
type: "array",
items: {
type: "string",
@@ -973,8 +973,8 @@ describe("createXMLExample", 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>`
var definition = {
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>`
let definition = {
"type": "array",
"items": {
"type": "object",
@@ -1013,8 +1013,8 @@ describe("createXMLExample", function () {

describe("object", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens>\n\t<alien>string</alien>\n\t<dog>0</dog>\n</aliens>"
let definition = {
type: "object",
properties: {
alien: {
@@ -1033,8 +1033,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<aliens>string</aliens>\n\t<dog>0</dog>\n</animals>"
let definition = {
type: "object",
properties: {
aliens: {
@@ -1056,8 +1056,8 @@ describe("createXMLExample", 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>"
var definition = {
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>"
let definition = {
type: "object",
properties: {
aliens: {
@@ -1084,8 +1084,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<id>0</id>\n</animals>"
let definition = {
type: "object",
properties: {
id: {
@@ -1105,8 +1105,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<id>0</id>\n\t<dog>string</dog>\n</animals>"
let definition = {
type: "object",
properties: {
id: {
@@ -1126,8 +1126,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<id>0</id>\n</animals>"
let definition = {
type: "object",
properties: {
id: {
@@ -1147,8 +1147,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<id>0</id>\n\t<dog>string</dog>\n</animals>"
let definition = {
type: "object",
properties: {
id: {
@@ -1168,8 +1168,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals id=\"0\">\n\t<dog>string</dog>\n</animals>"
let definition = {
type: "object",
properties: {
id: {
@@ -1191,8 +1191,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals test=\"0\">\n\t<dog>string</dog>\n</animals>"
let definition = {
type: "object",
properties: {
id: {
@@ -1215,8 +1215,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user id=\"42\">\n\t<role>admin</role>\n</user>"
let definition = {
type: "object",
properties: {
id: {
@@ -1242,8 +1242,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user id=\"one\">\n\t<role>string</role>\n</user>"
let definition = {
type: "object",
properties: {
id: {
@@ -1266,8 +1266,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user id=\"one\">\n\t<role>string</role>\n</user>"
let definition = {
type: "object",
properties: {
id: {
@@ -1290,8 +1290,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user id=\"one\">\n\t<role>string</role>\n</user>"
let definition = {
type: "object",
properties: {
id: {
@@ -1314,8 +1314,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user>\n\t<id>42</id>\n\t<role>admin</role>\n</user>"
let definition = {
type: "object",
properties: {
id: {
@@ -1338,8 +1338,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<dog>string</dog>\n\t<additionalProp>string</additionalProp>\n</animals>"
let definition = {
type: "object",
properties: {
dog: {
@@ -1358,8 +1358,8 @@ describe("createXMLExample", 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>"
var definition = {
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>"
let definition = {
type: "object",
properties: {
dog: {
@@ -1376,8 +1376,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens>\n\t<alien>string</alien>\n\t<dog>0</dog>\n</aliens>"
let definition = {
properties: {
alien: {
type: "string"
@@ -1395,8 +1395,8 @@ describe("createXMLExample", 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>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<additionalProp>string</additionalProp>\n</animals>"
let definition = {
additionalProperties: {
type: "string"
},


+ 21
- 21
test/mocha/core/system/system.jsx View File

@@ -34,7 +34,7 @@ describe("bound system", function(){
})

// When
var action = system.getSystem().joshActions.simple(1)
let action = system.getSystem().joshActions.simple(1)
expect(action).toEqual({
type: "newSimple"
})
@@ -65,7 +65,7 @@ describe("bound system", function(){
})

// When
var action = system.getSystem().joshActions.simple(1)
let action = system.getSystem().joshActions.simple(1)
expect(action).toEqual({
type: "newSimple",
oriActionResult: { type: "simple" },
@@ -123,7 +123,7 @@ describe("bound system", function(){
})

// When
var action = system.getSystem().kyleActions.simple(1)
let action = system.getSystem().kyleActions.simple(1)
expect(action).toEqual({
type: "simple",
firstWrap: true,
@@ -178,7 +178,7 @@ describe("bound system", function(){
})

// When
var action = system.getSystem().kyleActions.simple(1)
let action = system.getSystem().kyleActions.simple(1)
expect(action.type).toEqual("one-two-three")

})
@@ -257,7 +257,7 @@ describe("bound system", function(){
})

// When
var action = system.getSystem().kyleActions.simple(1)
let action = system.getSystem().kyleActions.simple(1)
expect(action.type).toEqual("called")

})
@@ -307,7 +307,7 @@ describe("bound system", function(){
})

// When
var res = system.getSystem().joshSelectors.simple(1)
let res = system.getSystem().joshSelectors.simple(1)
expect(res).toEqual({
state: fromJS({
one: 1
@@ -340,7 +340,7 @@ describe("bound system", function(){
})

// When
var res = system.getSystem().joshSelectors.advanced(1)
let res = system.getSystem().joshSelectors.advanced(1)
expect(res).toEqual("hi")

})
@@ -380,7 +380,7 @@ describe("bound system", function(){
})

// When
var res = system.getSystem().dogeSelectors.wow(1)
let res = system.getSystem().dogeSelectors.wow(1)
expect(res).toEqual("original wrapper")

})
@@ -479,7 +479,7 @@ describe("bound system", function(){
})

// When
var Component = system.getSystem().getComponent("test")
let Component = system.getSystem().getComponent("test")
const renderedComponent = render(<Component name="Test" />)
expect(renderedComponent.text()).toEqual("Test component")
})
@@ -525,7 +525,7 @@ describe("bound system", function(){
})

// When
var Component = system.getSystem().getComponent("ContainerComponent", true)
let Component = system.getSystem().getComponent("ContainerComponent", true)
const renderedComponent = render(
<Provider store={system.getStore()}>
<Component fromOwnProps="and this came from my own props" />
@@ -578,7 +578,7 @@ describe("bound system", function(){
})

// When
var Component = system.getSystem().getComponent("ContainerComponent", true)
let Component = system.getSystem().getComponent("ContainerComponent", true)
const renderedComponent = render(
<Provider store={system.getStore()}>
<Component fromOwnProps="and this came from my own props" />
@@ -613,7 +613,7 @@ describe("bound system", function(){
})

// When
var res = system.getSystem().wow()
let res = system.getSystem().wow()
expect(res).toEqual("so selective")
})
it("should call a preset plugin's `afterLoad` method after the plugin is loaded", function() {
@@ -640,7 +640,7 @@ describe("bound system", function(){
})

// When
var res = system.getSystem().wow()
let res = system.getSystem().wow()
expect(res).toEqual("so selective")
})
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
var res = system.getSystem().wow()
let res = system.getSystem().wow()
expect(res).toEqual("so selective")
})
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])

// When
var res = system.getSystem().wow()
let res = system.getSystem().wow()
expect(res).toEqual("so selective")
})
})
@@ -726,7 +726,7 @@ describe("bound system", function(){
})

// When
var res = system.getSystem().wow()
let res = system.getSystem().wow()
expect(res).toEqual("so selective")
})
})
@@ -757,7 +757,7 @@ describe("bound system", function(){
// When
expect(function() {
system.register([ThrowyPlugin])
// var resSystem = system.getSystem()
// let resSystem = system.getSystem()
}).toNotThrow()
})

@@ -934,7 +934,7 @@ describe("bound system", function(){
})

// When
var Component = system.getSystem().getComponent("BrokenComponent")
let Component = system.getSystem().getComponent("BrokenComponent")
const renderedComponent = render(<Component />)

// Then
@@ -962,7 +962,7 @@ describe("bound system", function(){
})

// When
var Component = system.getSystem().getComponent("BrokenComponent")
let Component = system.getSystem().getComponent("BrokenComponent")
const renderedComponent = render(<Component />)

// Then
@@ -985,7 +985,7 @@ describe("bound system", function(){
})

// When
var Component = system.getSystem().getComponent("BrokenComponent")
let Component = system.getSystem().getComponent("BrokenComponent")
const renderedComponent = render(<Component />)

// Then
@@ -1013,7 +1013,7 @@ describe("bound system", function(){
})

// When
var Component = system.getSystem().getComponent("BrokenComponent", true)
let Component = system.getSystem().getComponent("BrokenComponent", true)
const renderedComponent = render(
<Provider store={system.getStore()}>
<Component />


+ 5
- 5
test/mocha/core/system/wrapComponent.jsx View File

@@ -28,7 +28,7 @@ describe("wrapComponents", () => {
})

// When
var Component = system.getSystem().getComponents("wow")
let Component = system.getSystem().getComponents("wow")
const wrapper = render(<Component name="Normal" />)

const container = wrapper.children().first()
@@ -73,7 +73,7 @@ describe("wrapComponents", () => {
})

// When
var Component = system.getSystem().getComponents("wow")
let Component = system.getSystem().getComponents("wow")
const wrapper = render(<Component name="Normal" />)

const container = wrapper.children().first()
@@ -125,7 +125,7 @@ describe("wrapComponents", () => {
})

// Then
var Component = mySystem.getSystem().getComponents("wow")
let Component = mySystem.getSystem().getComponents("wow")
const wrapper = render(<Component name="Normal" />)

const container = wrapper.children().first()
@@ -179,7 +179,7 @@ describe("wrapComponents", () => {
])

// Then
var Component = mySystem.getSystem().getComponents("wow")
let Component = mySystem.getSystem().getComponents("wow")
const wrapper = render(<Component name="Normal" />)

const container = wrapper.children().first()
@@ -233,7 +233,7 @@ describe("wrapComponents", () => {
})

// Then
var Component = secondSystem.getSystem().getComponents("wow")
let Component = secondSystem.getSystem().getComponents("wow")
const wrapper = render(<Component name="Normal" />)

const container = wrapper.children().first()


Loading…
Cancel
Save