Skip to content

Commit

Permalink
tests(api): fix environment test unsucessfull when ran individually
Browse files Browse the repository at this point in the history
Related to keyshade-xyz#583
  • Loading branch information
muntaxir4 committed Dec 10, 2024
1 parent 6ce3489 commit c233a9c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { IsNotEmpty, IsOptional, IsString, Matches } from 'class-validator'
export class CreateEnvironment {
@IsString()
@IsNotEmpty()
@Matches(/^[a-zA-Z0-9-_]{1,64}$/)
name: string

@IsString()
Expand Down
5 changes: 3 additions & 2 deletions apps/api/src/environment/environment.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { UserModule } from '@/user/user.module'
import { UserService } from '@/user/service/user.service'
import { QueryTransformPipe } from '@/common/pipes/query.transform.pipe'
import { fetchEvents } from '@/common/event'
import { ValidationPipe } from '@nestjs/common'

describe('Environment Controller Tests', () => {
let app: NestFastifyApplication
Expand Down Expand Up @@ -65,7 +66,7 @@ describe('Environment Controller Tests', () => {
environmentService = moduleRef.get(EnvironmentService)
userService = moduleRef.get(UserService)

app.useGlobalPipes(new QueryTransformPipe())
app.useGlobalPipes(new ValidationPipe(), new QueryTransformPipe())

await app.init()
await app.getHttpAdapter().getInstance().ready()
Expand Down Expand Up @@ -184,7 +185,7 @@ describe('Environment Controller Tests', () => {
'x-e2e-user-email': user1.email
}
})

expect(response.statusCode).toBe(400)
expect(response.json().message).toContain('name should not be empty')
})
Expand Down

0 comments on commit c233a9c

Please sign in to comment.