![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/rentpix.corals.io/vendor/swagger-api/swagger-ui/test/unit/xss/ |
import React from "react" import { render } from "enzyme" import { fromJS } from "immutable" import Info from "core/components/info" import Markdown from "core/components/providers/markdown" describe("<Info/> Sanitization", function(){ const dummyComponent = () => null const components = { Markdown } const props = { getComponent: c => components[c] || dummyComponent, info: fromJS({ title: "Test Title **strong** <script>alert(1)</script>", description: "Description *with* <script>Markdown</script>" }), host: "example.test", basePath: "/api", selectedServer: "https://example.test", } it("renders sanitized .title content", function(){ let wrapper = render(<Info {...props}/>) expect(wrapper.find(".title").html()).toEqual("Test Title **strong** <script>alert(1)</script><span></span>") }) it("renders sanitized .description content", function() { let wrapper = render(<Info {...props}/>) expect(wrapper.find(".description").html()).toEqual("<div class=\"markdown\"><p>Description <em>with</em> </p>\n</div>") }) })