X-Git-Url: http://git.squeep.com/?p=squeep-indie-auther;a=blobdiff_plain;f=test%2Fsrc%2Fservice.js;fp=test%2Fsrc%2Fservice.js;h=d361df120b18b9891406f1bb7fe4e668f9124d75;hp=7a5e349df4af710a90f2e18c9ee58eeebb008db3;hb=6f9af8204a725b70fa65728cb0d627d8a5e5b348;hpb=f0c5fba2090d8ac2083b8dafc0d57ba5a6f68ed7 diff --git a/test/src/service.js b/test/src/service.js index 7a5e349..d361df1 100644 --- a/test/src/service.js +++ b/test/src/service.js @@ -187,21 +187,27 @@ describe('Service', function () { }); // handlerGetHealthcheck describe('handlerInternalServerError', function () { + let ServiceClass, DingusClass; + before(function () { + ServiceClass = Object.getPrototypeOf(service); + DingusClass = Object.getPrototypeOf(ServiceClass); + }); it('covers no redirect', async function () { - sinon.stub(service.__proto__.__proto__, 'handlerInternalServerError'); + sinon.stub(DingusClass, 'handlerInternalServerError'); await service.handlerInternalServerError(req, res, ctx); - assert(service.__proto__.__proto__.handlerInternalServerError.called); + assert(DingusClass.handlerInternalServerError.called); }); it('covers redirect', async function () { - sinon.stub(service.__proto__.__proto__, 'handlerInternalServerError'); + sinon.stub(DingusClass, 'handlerInternalServerError'); ctx.session = { redirectUri: new URL('https://client.example.com/app'), clientIdentifier: new URL('https://client.exmaple.com/'), state: '123456', }; await service.handlerInternalServerError(req, res, ctx); - assert(!service.__proto__.__proto__.handlerInternalServerError.called); - assert(res.setHeader); + assert(!DingusClass.handlerInternalServerError.called); + assert(res.setHeader.called); + assert.strictEqual(res.statusCode, 302); }); }); // handlerInternalServerError