Add initial test framework with TS by zbettenbuk · Pull Request #638 · prerender/prerender
This is super awesome. I like how the tests are set up. Simple and clear with the input/output files.
The only thing I'd change would just be a few function names in the tests to be a bit more verbose to more easily understand at a glance:
it('should respond properly to a simple non-js file', function(done) {
const fileName = 'basic-1.html';
new PrerenderServerInvoker(server.address, testInstance.address).matchFiles(fileName, testFiles.get(fileName)).then(match => {
assert.equal(match, true);
done();
}, done).catch(done);
});
Since you are starting an express server to serve the input files from a URL, I feel like it reads a little easier like:
it('should respond properly to a simple non-js file', function(done) {
const urlName = 'basic-1.html';
new PrerenderServerInvoker(server.address, testInstance.address).renderURLAndVerifyMatch(urlName, expectedOutputFiles.get(urlName)).then(match => {
assert.equal(match, true);
done();
}, done).catch(done);
});
It doesn't have to be exactly that, but something like that. Thoughts?