From bff776abf983eb611bb373e3612c2a7482098304 Mon Sep 17 00:00:00 2001 From: Quentin Monmert Date: Mon, 15 Aug 2022 19:11:42 +0200 Subject: [PATCH] [Vue] Increase Vue code coverage --- .../app/shared/config/axios-interceptor.spec.ts.ejs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/generators/client/templates/vue/src/test/javascript/spec/app/shared/config/axios-interceptor.spec.ts.ejs b/generators/client/templates/vue/src/test/javascript/spec/app/shared/config/axios-interceptor.spec.ts.ejs index 26c179753263..1d77ada12618 100644 --- a/generators/client/templates/vue/src/test/javascript/spec/app/shared/config/axios-interceptor.spec.ts.ejs +++ b/generators/client/templates/vue/src/test/javascript/spec/app/shared/config/axios-interceptor.spec.ts.ejs @@ -56,5 +56,17 @@ describe('Axios errors interceptor', () => { expect(callback.called).toBeTruthy(); } }); + it('should not use callback for errors different 50x, 401, 403', async () => { + const callback = sinon.spy(); + + setupAxiosConfig.setupAxiosInterceptors(() => {}, callback); + + try { + mock.onGet().reply(402); + await axios('/api/test'); + } catch { + expect(callback.called).toBeFalsy(); + } + }); });