hyperaudio / hyperaudio-lite

Hyperaudio Lite - a Super-lightweight Interactive Transcript Player

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 ...

  1. Add module.exports = caption; to the bottom of caption.js
  2. Add const caption = require("../js/caption"); to hyperaudio-lite.js
  3. 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");
});