diff --git a/src/tests/stack/stack.controller.spec.ts b/src/tests/stack/stack.controller.spec.ts index 0fa7587724057343758f6cce637c914599d7988f..4bcff741543c126209f29295217aa7788e87ddb2 100644 --- a/src/tests/stack/stack.controller.spec.ts +++ b/src/tests/stack/stack.controller.spec.ts @@ -57,7 +57,7 @@ describe('StackController', () => { body, }; const errors = []; - const response = {} + const response = {}; jest.spyOn(stackService, 'add').mockImplementation(() => response); jest.spyOn(validateService, 'validateBody').mockResolvedValue(errors); @@ -69,8 +69,8 @@ describe('StackController', () => { }); }); - describe('get item from stack and remove it', () => { - it('When stack is empty -> should return 204', () => { + describe('get item from stack and remove it', () => { + it('When stack is empty -> should return 204', () => { const body = {}; const mockRequest = { body, @@ -86,7 +86,7 @@ describe('StackController', () => { expect(stackService.get).not.toBeCalled(); }); - it('When stack is not empty -> should return 200', () => { + it('When stack is not empty -> should return 200', () => { const body = {}; const mockRequest = { body, diff --git a/src/tests/stack/stack.repository.spec.ts b/src/tests/stack/stack.repository.spec.ts index f1955d9dbcb0e05dd3c0c5a57842ec467e36c02f..d6554afcb33fba782611c7e950cdf1e1eef81af5 100644 --- a/src/tests/stack/stack.repository.spec.ts +++ b/src/tests/stack/stack.repository.spec.ts @@ -18,7 +18,7 @@ describe('StackRepository', () => { describe('add', () => { it('Should return created item', () => { - const data = 'some data' + const data = 'some data'; const dto = { data, }; @@ -32,8 +32,8 @@ describe('StackRepository', () => { }); describe('get', () => { - it('Should call pop method', () => { - const data = 'some data' + it('Should call pop method', () => { + const data = 'some data'; const dto = { data, }; @@ -47,7 +47,7 @@ describe('StackRepository', () => { }); describe('isEmpty', () => { - it('When stack is empty -> should return true', () => { + it('When stack is empty -> should return true', () => { const length = 0; jest.spyOn(stackModel, 'getLength').mockImplementation(() => length); @@ -57,7 +57,7 @@ describe('StackRepository', () => { expect(result).toBe(true); }); - it('When stack is not empty -> should return false', () => { + it('When stack is not empty -> should return false', () => { const length = 2; jest.spyOn(stackModel, 'getLength').mockImplementation(() => length); diff --git a/src/tests/stack/stack.validation-service.spec.ts b/src/tests/stack/stack.validation-service.spec.ts index 674b6ef8f890f65b0d2bde619d92f8dffa4ba2b7..7b716aa6f94a2a6a9313211f253de580b30fec50 100644 --- a/src/tests/stack/stack.validation-service.spec.ts +++ b/src/tests/stack/stack.validation-service.spec.ts @@ -13,9 +13,9 @@ describe('StackValidationService', () => { jest.clearAllMocks(); }); - describe('validateBody', () => { + describe('validateBody', () => { describe('When body does not pass validation', () => { - it('When body has extra properties -> should return errors', async () => { + it('When body has extra properties -> should return errors', async () => { const body = { data: 'some data', extra: 100, @@ -26,7 +26,7 @@ describe('StackValidationService', () => { expect(errors.length).not.toBe(0); }); - it('When body is empty -> should return errors', async () => { + it('When body is empty -> should return errors', async () => { const body: any = {}; const errors = await validateService.validateBody(body); @@ -34,7 +34,7 @@ describe('StackValidationService', () => { expect(errors.length).not.toBe(0); }); - it('When body wrong fields -> should return errors', async () => { + it('When body wrong fields -> should return errors', async () => { const body: any = { dara: 6, }; @@ -46,7 +46,7 @@ describe('StackValidationService', () => { }); describe('When body pass validation', () => { - it('Should return empty array of errors', async () => { + it('Should return empty array of errors', async () => { const body = { data: 'some data', }; @@ -55,6 +55,6 @@ describe('StackValidationService', () => { expect(errors.length).toBe(0); }); - }) + }); }); }); diff --git a/src/tests/ttl/ttl.controller.spec.ts b/src/tests/ttl/ttl.controller.spec.ts index f3d6ddec189f38bf0d03707d6a64e403d83e9ecd..0282f99a0129391086070fdfe7a7378df609a64f 100644 --- a/src/tests/ttl/ttl.controller.spec.ts +++ b/src/tests/ttl/ttl.controller.spec.ts @@ -5,7 +5,11 @@ import { TtlService } from '../../modules/ttl/ttl.service'; import { TtlValidationService } from '../../modules/ttl/validation'; import { LoggerService } from '../../shared/logger'; import { StatusCodes } from '../../common/constants'; -import { BadRequestException, ConflictException, NotFoundException } from '../../exceptions/http-exception'; +import { + BadRequestException, + ConflictException, + NotFoundException, +} from '../../exceptions/http-exception'; const mockResponse = { json: jest.fn(), @@ -40,9 +44,9 @@ describe('TtlController', () => { }; const errors: any[] = [new Error('Wrong data')]; jest.spyOn(validateService, 'validateBody').mockResolvedValue(errors); - jest.spyOn(ttlService, 'get').mockImplementation(() => ({}) as any); - jest.spyOn(ttlService, 'add').mockImplementation(() => ({}) as any); - jest.spyOn(logger, 'error').mockImplementation(() => ({}) as any); + jest.spyOn(ttlService, 'get').mockImplementation(() => ({} as any)); + jest.spyOn(ttlService, 'add').mockImplementation(() => ({} as any)); + jest.spyOn(logger, 'error').mockImplementation(() => ({} as any)); await ttlController.add(mockRequest, mockResponse, mockNextFunction); @@ -54,16 +58,16 @@ describe('TtlController', () => { }); describe('When body passes validation', () => { - it('When key already exists -> should return 409', async () => { + it('When key already exists -> should return 409', async () => { const body = {}; const mockRequest: any = { body, }; const errors: any[] = []; jest.spyOn(validateService, 'validateBody').mockResolvedValue(errors); - jest.spyOn(ttlService, 'get').mockImplementation(() => ({}) as any); - jest.spyOn(ttlService, 'add').mockImplementation(() => ({}) as any); - jest.spyOn(logger, 'error').mockImplementation(() => ({}) as any); + jest.spyOn(ttlService, 'get').mockImplementation(() => ({} as any)); + jest.spyOn(ttlService, 'add').mockImplementation(() => ({} as any)); + jest.spyOn(logger, 'error').mockImplementation(() => ({} as any)); await ttlController.add(mockRequest, mockResponse, mockNextFunction); @@ -75,13 +79,13 @@ describe('TtlController', () => { expect(ttlService.add).not.toBeCalled(); }); - it('When key does not exist -> should return 201', async () => { + it('When key does not exist -> should return 201', async () => { const body = {}; const mockRequest: any = { body, }; const errors: any[] = []; - const result: any = {} + const result: any = {}; jest.spyOn(validateService, 'validateBody').mockResolvedValue(errors); jest.spyOn(ttlService, 'get').mockImplementation(() => null as any); jest.spyOn(ttlService, 'add').mockImplementation(() => result); @@ -98,7 +102,7 @@ describe('TtlController', () => { }); describe('get item', () => { - it('When key does not exist -> should return 404', () => { + it('When key does not exist -> should return 404', () => { const params = { key: '', }; @@ -106,7 +110,7 @@ describe('TtlController', () => { params, }; jest.spyOn(ttlService, 'get').mockImplementation(() => null as any); - jest.spyOn(logger, 'error').mockImplementation(() => ({}) as any); + jest.spyOn(logger, 'error').mockImplementation(() => ({} as any)); ttlController.get(mockRequest, mockResponse, mockNextFunction); @@ -115,7 +119,7 @@ describe('TtlController', () => { expect(mockResponse.status).not.toBeCalled(); }); - it('When key exists -> should return 200', () => { + it('When key exists -> should return 200', () => { const params = { key: '', }; @@ -142,7 +146,7 @@ describe('TtlController', () => { }; const response: any = null; jest.spyOn(ttlService, 'remove').mockImplementation(() => response); - jest.spyOn(logger, 'error').mockImplementation(() => ({}) as any); + jest.spyOn(logger, 'error').mockImplementation(() => ({} as any)); ttlController.remove(mockRequest, mockResponse, mockNextFunction); diff --git a/src/tests/ttl/ttl.validation-service.spec.ts b/src/tests/ttl/ttl.validation-service.spec.ts index 2a8acf41a9027d35019828ca11efe09d6ad69b58..e0e87b64d6fbc2bb044b3c1945dd1d1dff01f0aa 100644 --- a/src/tests/ttl/ttl.validation-service.spec.ts +++ b/src/tests/ttl/ttl.validation-service.spec.ts @@ -13,9 +13,9 @@ describe('TtlValidationService', () => { jest.clearAllMocks(); }); - describe('validateBody', () => { + describe('validateBody', () => { describe('When body does not pass validation', () => { - it('When body has extra properties -> should return errors', async () => { + it('When body has extra properties -> should return errors', async () => { const body = { key: 'name', value: 100, @@ -27,7 +27,7 @@ describe('TtlValidationService', () => { expect(errors.length).not.toBe(0); }); - it('When body is empty -> should return errors', async () => { + it('When body is empty -> should return errors', async () => { const body: any = {}; const errors = await validateService.validateBody(body); @@ -35,7 +35,7 @@ describe('TtlValidationService', () => { expect(errors.length).not.toBe(0); }); - it('When body fields have wrong format -> should return errors', async () => { + it('When body fields have wrong format -> should return errors', async () => { const body: any = { key: 6, value: 100, @@ -48,7 +48,7 @@ describe('TtlValidationService', () => { }); describe('When body pass validation', () => { - it('Should return empty array of errors', async () => { + it('Should return empty array of errors', async () => { const body = { key: 'name', value: 'John', @@ -58,6 +58,6 @@ describe('TtlValidationService', () => { expect(errors.length).toBe(0); }); - }) + }); }); });