Use api for view search tests

This commit is contained in:
Adria Navarro 2023-07-19 12:39:41 +02:00
parent 2feb22ef64
commit 6809bb4510
2 changed files with 9 additions and 5 deletions

View File

@ -717,11 +717,7 @@ describe("/rows", () => {
const createViewResponse = await config.api.viewV2.create()
const response = await request
.get(`/api/v2/views/${createViewResponse._id}/search`)
.set(config.defaultHeaders())
.expect("Content-Type", /json/)
.expect(200)
const response = await config.api.viewV2.search(createViewResponse._id!)
expect(response.body.rows).toHaveLength(10)
expect(response.body).toEqual({

View File

@ -62,4 +62,12 @@ export class ViewV2API extends TestAPI {
.set(this.config.defaultHeaders())
.expect(expectStatus)
}
search = async (viewId: string, { expectStatus } = { expectStatus: 200 }) => {
return this.request
.get(`/api/v2/views/${viewId}/search`)
.set(this.config.defaultHeaders())
.expect("Content-Type", /json/)
.expect(expectStatus)
}
}