Open Chris0lsen opened 8 years ago
How did you get on with this? Would it be viable to use something like phantomjs to render it and then snapshot it? I guess casperjs wouldn't be viable as you don't have a DOM to use for assertions but perhaps there is something to be done is this project or another to resolve that?
Hi Tim,
I've skipped writing tests for this, for now. The problem got me thinking, though, and I'll bet that, until there is an accessible PDFKit DOM, you could use ResembleJS to compare your test output to a master - but that doesn't lead to very dynamic tests...
I think this kind of thing is probably out of scope for this package but it would be helpful to document an approach using other tools.
I'd like to do better than my current test suite which consists of
expect(document.substring(0, 6)).toBe('%PDF-1')
I'm writing tests for a chunk of code that spits out a report using PDFKit, and I think it'd be helpful to have an API for asserting that things ended up where you expected them to on the page. Even just getter methods for seeing the values in the pdfkit object - unless these are already present, and I'm just not seeing them (I don't work in coffeescript, so I could very well be overlooking something).
I don't know if anybody else would find value in this, but I can think of a few cases where regression testing could come in handy: