diff --git a/package.json b/package.json index 7d9f530f..9f5001fd 100644 --- a/package.json +++ b/package.json @@ -8,12 +8,12 @@ "scripts": { "prebuild": "rimraf dist", "build": "nest build", - "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", + "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\" \"test_acceptance/**/*.ts\"", "start": "nest start", "start:dev": "nest start --watch", "start:debug": "nest start --debug --watch", "start:prod": "node dist/main", - "lint": "eslint \"{src,apps,libs,test}/**/*.ts\"", + "lint": "eslint \"{src,apps,libs,test,test_acceptance}/**/*.ts\"", "test": "jest --projects src", "test:watch": "jest --projects src --watch", "test:cov": "jest --projects src --coverage", diff --git a/test_acceptance/acceptance.spec.ts b/test_acceptance/acceptance.spec.ts index 279c3294..b84eb0ac 100644 --- a/test_acceptance/acceptance.spec.ts +++ b/test_acceptance/acceptance.spec.ts @@ -1,30 +1,179 @@ import { User } from '@prisma/client'; -import axios from 'axios' +import axios from 'axios'; +import { ProjectDto } from 'src/projects/dto/project.dto'; import { UserLoginRequestDto } from 'src/users/dto/user-login-request.dto'; import { UserLoginResponseDto } from 'src/users/dto/user-login-response.dto'; import uuidAPIKey from 'uuid-apikey'; axios.defaults.baseURL = 'http://localhost:4200'; -let user: Partial = { - email: `${uuidAPIKey.create().uuid}@example.com`, - password: '123456', - firstName: 'fName', - lastName: 'lName', +const user: Partial = { + email: `${uuidAPIKey.create().uuid}@example.com`, + password: '123456', + firstName: 'fName', + lastName: 'lName', }; const loginData: UserLoginRequestDto = { - email: user.email, - password: user.password, -} + email: user.email, + password: user.password, +}; describe('Acceptance', () => { + test('Register and login', async () => { + await axios.post('/users/register', user); + + const response = await axios.post('/users/login', loginData); + + expect(response.status).toBe(201); + expect(response.data.token).toBeDefined(); + }); + + test('Health Check', async () => { + const url = '/health'; + }); + + test('User Registration', async () => { + const url = '/users/register'; + }); + + test('User Login', async () => { + const url = '/users/login'; + }); + + test('Generate New API Key for User', async () => { + const url = '/users/newApiKey'; + }); + + test('Change User Password', async () => { + const url = '/users/password'; + }); + + test('Update User Information', async () => { + const url = '/users'; + // axios.put(); + }); + + test('Delete User', async () => { + const url = '/users'; + // axios.delete(); + }); + + test('Get List of All Users', async () => { + const url = '/users/all'; + }); + + test('Assign Role to User', async () => { + const url = '/users/assignRole'; + // axios.patch(); + }); + + test('Get List of Builds', async () => { + const url = '/builds'; + }); + + test('Create a Build', async () => { + const url = '/builds'; + // axios.post(); + }); + + test('Get Build Details', async () => { + const url = '/builds/{id}'; + }); + + test('Remove a Build', async () => { + const url = '/builds/{id}'; + // axios.delete(); + }); + + test('Update Build Information', async () => { + const url = '/builds/{id}'; + // axios.patch(); + }); + + test('Approve a Build', async () => { + const url = '/builds/{id}/approve'; + // axios.patch(); + }); + + test('Get List of Test Variations', async () => { + const url = '/test-variations'; + }); + + test('Get Test Variation Details', async () => { + const url = '/test-variations/details/{id}'; + }); + + test('Merge Test Variations', async () => { + const url = '/test-variations/merge'; + }); + + test('Delete Test Variation', async () => { + const url = '/test-variations/{id}'; + // axios.delete(); + }); + + test('Get List of Test Runs', async () => { + const url = '/test-runs'; + }); + + test('Create a Test Run', async () => { + const url = '/test-runs'; + // axios.post(); + }); + + test('Get Test Run Details', async () => { + const url = '/test-runs/{id}'; + }); + + test('Approve a Test Run', async () => { + const url = '/test-runs/approve'; + // axios.post(); + }); + + test('Reject a Test Run', async () => { + const url = '/test-runs/reject'; + // axios.post(); + }); + + test('Delete a Test Run', async () => { + const url = '/test-runs/delete'; + // axios.post(); + }); + + test('Update Ignore Areas for a Test Run', async () => { + const url = '/test-runs/ignoreAreas/update'; + // axios.post(); + }); + + test('Add Ignore Areas to a Test Run', async () => { + const url = '/test-runs/ignoreAreas/add'; + // axios.post(); + }); + + test('Update a Test Run', async () => { + const url = '/test-runs/update/{testRunId}'; + // axios.patch(); + }); + + test('Create a Test Run with Multipart Data', async () => { + const url = '/test-runs/multipart'; + // axios.post(); + }); - test('Register and login', async () => { - await axios.post('/users/register', user); + test('Get List of Projects', async () => { + const url = '/projects'; + const response = await axios.get(url); + + expect(response.status).toBe(401); // Not authorized + }); - const response = await axios.post('/users/login', loginData) + test('Create a Project', async () => { + const url = '/projects'; + // axios.post(); + }); - expect(response.status).toBe(201) - expect(response.data.token).toBeDefined() - }) -}) \ No newline at end of file + test('Remove a Project', async () => { + const url = '/projects/{id}'; + // axios.delete(); + }); +});