Test caption generation
maboa opened this issue · comments
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 ofcaption.js
- Add
const caption = require("../js/caption");
tohyperaudio-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");
});