feat: update delete connection endpoint and add integration tests#1672
Merged
feat: update delete connection endpoint and add integration tests#1672
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds end-to-end coverage for the SaaS “hosted connection” create/delete endpoints and adjusts the SaaS controller/DTO to align with the hosted-DB deletion contract.
Changes:
- Added a new AVA E2E test suite validating hosted connection create/delete flows plus SaaS auth/validation error cases.
- Updated the SaaS hosted-delete route decorator path.
- Relaxed
hostedDatabaseIdvalidation in the hosted-delete DTO (no longer constrained to UUID).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
backend/test/ava-tests/saas-tests/hosted-connection-e2e.test.ts |
New E2E tests for /saas/connection/hosted and /saas/connection/hosted/delete, including auth + negative cases. |
backend/src/microservices/saas-microservice/saas.controller.ts |
Adjusts the hosted-delete route decorator path formatting. |
backend/src/microservices/saas-microservice/data-structures/delete-connection-for-hosted-db.dto.ts |
Removes UUID validation for hostedDatabaseId and tweaks Swagger metadata formatting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+52
to
+55
| function generateSaasToken(): string { | ||
| const jwtSecret = process.env.MICROSERVICE_JWT_SECRET; | ||
| return jwt.sign({ request_id: faker.string.uuid() }, jwtSecret, { expiresIn: '1h' }); | ||
| } |
Comment on lines
+1
to
+28
| /* eslint-disable @typescript-eslint/no-unused-vars */ | ||
| import { faker } from '@faker-js/faker'; | ||
| import { INestApplication, ValidationPipe } from '@nestjs/common'; | ||
| import { Test } from '@nestjs/testing'; | ||
| import test from 'ava'; | ||
| import { ValidationError } from 'class-validator'; | ||
| import cookieParser from 'cookie-parser'; | ||
| import jwt from 'jsonwebtoken'; | ||
| import request from 'supertest'; | ||
| import { ApplicationModule } from '../../../src/app.module.js'; | ||
| import { AccessLevelEnum } from '../../../src/enums/index.js'; | ||
| import { ValidationException } from '../../../src/exceptions/custom-exceptions/validation-exception.js'; | ||
| import { Cacher } from '../../../src/helpers/cache/cacher.js'; | ||
| import { DatabaseModule } from '../../../src/shared/database/database.module.js'; | ||
| import { DatabaseService } from '../../../src/shared/database/database.service.js'; | ||
| import { registerUserAndReturnUserInfo } from '../../utils/register-user-and-return-user-info.js'; | ||
| import { TestUtils } from '../../utils/test.utils.js'; | ||
|
|
||
| let app: INestApplication; | ||
| let _testUtils: TestUtils; | ||
| let currentTest: string; | ||
|
|
||
| test.before(async () => { | ||
| const moduleFixture = await Test.createTestingModule({ | ||
| imports: [ApplicationModule, DatabaseModule], | ||
| providers: [DatabaseService, TestUtils], | ||
| }).compile(); | ||
| _testUtils = moduleFixture.get<TestUtils>(TestUtils); |
Comment on lines
21
to
25
| @ApiProperty({ | ||
| description: 'Database name', | ||
| example: 'my_database', | ||
| example: 'my_database', | ||
| }) | ||
| databaseName: string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.