diff --git a/test/components/json-schema-form.js b/test/components/json-schema-form.js
index abf73d39..ba551919 100644
--- a/test/components/json-schema-form.js
+++ b/test/components/json-schema-form.js
@@ -1,18 +1,17 @@
/* eslint-env mocha */
import React from "react"
import expect, { createSpy } from "expect"
-import { Select } from "components/layout-utils"
+import { Select, Input } from "components/layout-utils"
import { render } from "enzyme"
import * as JsonSchemaComponents from "core/json-schema-components"
import { JsonSchemaForm } from "core/json-schema-components"
-const components = {...JsonSchemaComponents, Select}
+const components = {...JsonSchemaComponents, Select, Input}
const getComponentStub = (name) => {
- return components[name] || (() => {
- console.error(`Couldn't find "${name}"`)
- return null
- })
+ if(components[name]) return components[name]
+
+ return null
}
describe("", function(){
@@ -108,4 +107,48 @@ describe("", function(){
expect(wrapper.find("select option").first().text()).toEqual("true")
})
})
+ describe("unknown types", function() {
+ it("should render unknown types as strings", function(){
+
+ let props = {
+ getComponent: getComponentStub,
+ value: "yo",
+ onChange: () => {},
+ keyName: "",
+ fn: {},
+ schema: {
+ type: "NotARealType"
+ }
+ }
+
+
+ let wrapper = render()
+
+ expect(wrapper.find("input").length).toEqual(1)
+ // expect(wrapper.find("select input").length).toEqual(1)
+ // expect(wrapper.find("select option").first().text()).toEqual("true")
+ })
+
+ it("should render unknown types as strings when a format is passed", function(){
+
+ let props = {
+ getComponent: getComponentStub,
+ value: "yo",
+ onChange: () => {},
+ keyName: "",
+ fn: {},
+ schema: {
+ type: "NotARealType",
+ format: "NotARealFormat"
+ }
+ }
+
+
+ let wrapper = render()
+
+ expect(wrapper.find("input").length).toEqual(1)
+ // expect(wrapper.find("select input").length).toEqual(1)
+ // expect(wrapper.find("select option").first().text()).toEqual("true")
+ })
+ })
})