Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test caption generation #114

Open
maboa opened this issue Aug 2, 2022 · 0 comments
Open

Test caption generation #114

maboa opened this issue Aug 2, 2022 · 0 comments
Labels

Comments

@maboa
Copy link
Member

maboa commented Aug 2, 2022

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");
});
@maboa maboa added the tests label Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant