KaTeX icon indicating copy to clipboard operation
KaTeX copied to clipboard

Write tests for the CLI

Open kevinbarabash opened this issue 6 years ago • 3 comments

It seems like this shouldn't be too hard to do. We could either search for particular strings in the output or use jest's snapshot feature. Not sure what's the most maintainable, maybe the snapshots if we formatted the output a bit. I think the cli just outputs a blob, but for diffing purposes we'd probably want to format it so that we have one tag per line. There are a couple of HTML formatters we could use.

kevinbarabash avatar Jul 27 '18 01:07 kevinbarabash

Perhaps we could just test for equality between calling KaTeX via cli.js and via renderToString? Still useful to test that the command-line argument parsing is working.

edemaine avatar Jul 27 '18 02:07 edemaine

That's a really good idea.

kevinbarabash avatar Jul 27 '18 02:07 kevinbarabash

We should also test for duplicate command-line options passed into commander, probably by parsing SETTINGS_SCHEMA ourselves. (see #3375)

edemaine avatar Oct 30 '21 19:10 edemaine