diff --git a/e2e-tests/app.e2e-spec.ts b/e2e-tests/app.e2e-spec.ts deleted file mode 100644 index 50cda62..0000000 --- a/e2e-tests/app.e2e-spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { INestApplication } from '@nestjs/common'; -import * as request from 'supertest'; -import { AppModule } from './../src/app.module'; - -describe('AppController (e2e)', () => { - let app: INestApplication; - - beforeEach(async () => { - const moduleFixture: TestingModule = await Test.createTestingModule({ - imports: [AppModule], - }).compile(); - - app = moduleFixture.createNestApplication(); - await app.init(); - }); - - it('/ (GET)', () => { - return request(app.getHttpServer()) - .get('/') - .expect(200) - .expect('Hello World!'); - }); -}); diff --git a/e2e-tests/jest-e2e.json b/e2e-tests/jest-e2e.json deleted file mode 100644 index e9d912f..0000000 --- a/e2e-tests/jest-e2e.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "moduleFileExtensions": ["js", "json", "ts"], - "rootDir": ".", - "testEnvironment": "node", - "testRegex": ".e2e-spec.ts$", - "transform": { - "^.+\\.(t|j)s$": "ts-jest" - } -} diff --git a/package.json b/package.json index 126906b..f4d013a 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,6 @@ "test:watch": "jest --watch", "test:cov": "jest --coverage", "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", - "test:e2e": "jest --config e2e-tests/jest-e2e.json", "prepare": "husky install" }, "dependencies": { @@ -77,7 +76,7 @@ "collectCoverageFrom": [ "**/*.(t|j)s" ], - "coverageDirectory": "../coverage", + "coverageDirectory": "/coverage", "testEnvironment": "node", "moduleNameMapper": { "@/(.*)": "/src/$1", diff --git a/tests/utils/uuidTransformer.spec.ts b/tests/utils/uuidTransformer.spec.ts index 20e1d7b..f109faa 100644 --- a/tests/utils/uuidTransformer.spec.ts +++ b/tests/utils/uuidTransformer.spec.ts @@ -17,11 +17,24 @@ describe('uuidTransformer util', () => { expect(transformer.from(null)).toBe(NIL); }); + it('From method should throw an error if paring an invalid length buffer', () => { + expect(() => transformer.from(Buffer.alloc(15))).toThrow(); + }); + it('From method should return a nil uuid if empty 16 length buffer is passed', () => { expect(transformer.from(Buffer.alloc(16))).toBe(NIL); }); + it('From and To methods should be each others inverse', () => { + const uuid = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'; + expect(transformer.from(transformer.to(uuid))).toBe(uuid); + }); + it('To method should return a buffer matching the uuid', () => { expect(transformer.to(NIL)).toEqual(Buffer.alloc(16)); }); + + it('To method throw an error if passing a string that does not match a uuid', () => { + expect(() => transformer.to('test')).toThrow(); + }); });