jsdom testing code example
Example: jsdom testing
// First install JSDOM
// Run: npm i jsdom.
// Or find out various way you can do that.
// Require jsdom.
const jsdom = require("jsdom");
//Create a JSBOM object.
const dom = new JSDOM(fs.readFileSync("htmlFileName"));
// Now test that Object.
// You can even manipulate it too, its an object afterall
// This prints "My First JSDOM!".
console.log(dom.window.document.getElementById("elementId").textContent);