import React from "react"
import { render } from "enzyme"
import { fromJS } from "immutable"
import Info from "components/info"
import Markdown from "components/providers/markdown"
describe(" Sanitization", function(){
const dummyComponent = () => null
const components = {
Markdown
}
const props = {
getComponent: c => components[c] || dummyComponent,
info: fromJS({
title: "Test Title **strong** ",
description: "Description *with* "
}),
host: "example.test",
basePath: "/api",
selectedServer: "https://example.test",
}
it("renders sanitized .title content", function(){
let wrapper = render()
expect(wrapper.find(".title").html()).toEqual("Test Title **strong** <script>alert(1)</script>")
})
it("renders sanitized .description content", function() {
let wrapper = render()
expect(wrapper.find(".description").html()).toEqual("
")
})
})