+
+ describe('handlerRedirect', function () {
+ let req, res, ctx;
+ beforeEach(function () {
+ req = {
+ getHeader: sinon.stub(),
+ };
+ res = {
+ setHeader: sinon.stub(),
+ end: sinon.stub(),
+ };
+ ctx = {};
+ });
+ it('covers', async function () {
+ await dingus.handlerRedirect(req, res, ctx);
+ assert(res.setHeader.called);
+ assert(res.end.called);
+ });
+ it('covers non-defaults', async function () {
+ await dingus.handlerRedirect(req, res, ctx, 308);
+ assert(res.setHeader.called);
+ assert(res.end.called);
+ });
+ }); // handlerRedirect
+
+ describe('handlerGetStaticFile', function () {
+ let req, res, ctx;
+ beforeEach(function () {
+ req = {
+ getHeader: sinon.stub(),
+ };
+ res = {
+ setHeader: sinon.stub(),
+ };
+ ctx = {
+ params: {
+ file: '',
+ },
+ };
+ sinon.stub(dingus, 'serveFile');
+ });
+ it('covers', async function () {
+ await dingus.handlerGetStaticFile(req, res, ctx);
+ assert(dingus.serveFile.called);
+ });
+ it('covers specified file', async function () {
+ await dingus.handlerGetStaticFile(req, res, ctx, 'file.txt');
+ assert(dingus.serveFile.called);
+ });
+ }); // handlerGetStaticFile