Skip to content

Commit

Permalink
Improve e2e test and fix explicit number conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
muntaxir4 committed Jul 28, 2024
1 parent 5b1e31f commit eb932cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion apps/api/src/integration/integration.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { MAIL_SERVICE } from '../mail/services/interface.service'
import { MockMailService } from '../mail/services/mock.service'
import { EnvironmentModule } from '../environment/environment.module'
import { EnvironmentService } from '../environment/service/environment.service'
import { QueryTransformPipe } from '../common/query.transform.pipe'

describe('Integration Controller Tests', () => {
let app: NestFastifyApplication
Expand Down Expand Up @@ -66,6 +67,8 @@ describe('Integration Controller Tests', () => {
projectService = moduleRef.get(ProjectService)
environmentService = moduleRef.get(EnvironmentService)

app.useGlobalPipes(new QueryTransformPipe())

await app.init()
await app.getHttpAdapter().getInstance().ready()
})
Expand Down Expand Up @@ -602,7 +605,7 @@ describe('Integration Controller Tests', () => {
it('should be able to fetch all integrations on first page', async () => {
const result = await app.inject({
method: 'GET',
url: `/integration/all/${workspace1.id}`,
url: `/integration/all/${workspace1.id}?page=0&limit=10`,
headers: {
'x-e2e-user-email': user1.email
}
Expand All @@ -613,6 +616,7 @@ describe('Integration Controller Tests', () => {

//check metadata
const metadata = result.json().metadata
expect(metadata.totalCount).toEqual(1)
expect(metadata.links.self).toEqual(
`/integration/all/${workspace1.id}?page=0&limit=10&sort=name&order=asc&search=`
)
Expand Down
6 changes: 3 additions & 3 deletions apps/api/src/integration/service/integration.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ export class IntegrationService {
]
},
skip: page * limit,
take: Number(limit),
take: limit,
orderBy: {
[sort]: order
}
Expand All @@ -323,8 +323,8 @@ export class IntegrationService {
}
})
const metadata = paginate(totalCount, `/integration/all/${workspaceId}`, {
page: Number(page),
limit: Number(limit),
page,
limit,
sort,
order,
search
Expand Down

0 comments on commit eb932cf

Please sign in to comment.