Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536
  1. import React from "react"
  2. import expect from "expect"
  3. import { shallow } from "enzyme"
  4. import ResponseBody from "components/response-body"
  5. import { inferSchema } from "corePlugins/samples/fn"
  6. describe("<ResponseBody />", function() {
  7. const highlightCodeComponent = () => null
  8. const components = {
  9. highlightCode: highlightCodeComponent
  10. }
  11. const props = {
  12. getComponent: c => components[c],
  13. }
  14. it("renders ResponseBody as 'application/json'", function() {
  15. props.contentType = "application/json"
  16. props.content = "{\"key\": \"a test value\"}"
  17. const wrapper = shallow(<ResponseBody {...props}/>)
  18. expect(wrapper.find("highlightCodeComponent").length).toEqual(1)
  19. })
  20. it("renders ResponseBody as 'text/html'", function() {
  21. props.contentType = "application/json"
  22. props.content = "<b>Result</b>"
  23. const wrapper = shallow(<ResponseBody {...props}/>)
  24. expect(wrapper.find("highlightCodeComponent").length).toEqual(1)
  25. })
  26. it("renders ResponseBody as 'image/svg'", function() {
  27. props.contentType = "image/svg"
  28. const wrapper = shallow(<ResponseBody {...props}/>)
  29. console.warn(wrapper.debug())
  30. expect(wrapper.find("highlightCodeComponent").length).toEqual(0)
  31. })
  32. })