This is non trivial due to this constraint ...
https://stackoverflow.com/questions/47902335/innertext-is-undefined-in-jest-test
It might be worth waiting until caption.js operates on a JSON representation of the timed data, rather than an HTML version.
For future consideration, this is how you'd set up the test ...
- Add
module.exports = caption; to the bottom of caption.js
- Add
const caption = require("../js/caption"); to hyperaudio-lite.js
- add a test something like this ...
test("caption generation - SRT", () => {
let cap = caption();
let subs = cap.init("hypertranscript", null, null, null); // transcript Id, player Id, max chars, min chars for caption line
expect(subs.srt).toStrictEqual("something goes here");
});
This is non trivial due to this constraint ...
https://stackoverflow.com/questions/47902335/innertext-is-undefined-in-jest-test
It might be worth waiting until
caption.jsoperates on a JSON representation of the timed data, rather than an HTML version.For future consideration, this is how you'd set up the test ...
module.exports = caption;to the bottom ofcaption.jsconst caption = require("../js/caption");tohyperaudio-lite.js