我有一个脚本,可将markdown转换为文档上的html,我正在尝试测试html呈现。这就是我到目前为止所拥有的。
<html>
<head>
<script
type="text/javascript"
src="https://rawcdn.githack.com/oscarmorrison/md-page/master/md-page.js"
></script>
</head>
<body>
<noscript># hello</noscript>
</body>
</html>
这是我的Jest文件。
describe("HTML Rendering Tests: Ensures that syntax is converted successfully.", () => {
beforeAll(() => {
const s = document.createElement("script");
s.type = "text/javascript";
s.src = "https://rawcdn.githack.com/oscarmorrison/md-page/master/md-page.js";
document.head.appendChild(s);
});
test('it should load scripts', () => {
document.body.innerHTML = '<noscript># hello';
expect(document.body).toContain('Hello');
});
});
我已经打印了其中的所有内容,似乎并没有将文本翻译成markdown。有什么想法吗?
<head><script type="text/javascript" src="https://rawcdn.githack.com/oscarmorrison/md-page/master/md-page.js"></script></head><body><noscript># hello</noscript></body>