Migrate RowAPI.save
This commit is contained in:
parent
d5c6ab8648
commit
a639ba91d3
|
@ -1486,7 +1486,7 @@ describe.each([
|
|||
email: "joe@joe.com",
|
||||
roles: {},
|
||||
},
|
||||
{ expectStatus: 400 }
|
||||
{ status: 400 }
|
||||
)
|
||||
expect(response.message).toBe("Cannot create new user entry.")
|
||||
})
|
||||
|
|
|
@ -35,21 +35,12 @@ export class RowAPI extends TestAPI {
|
|||
save = async (
|
||||
tableId: string,
|
||||
row: SaveRowRequest,
|
||||
{ expectStatus } = { expectStatus: 200 }
|
||||
expectations?: Expectations
|
||||
): Promise<Row> => {
|
||||
const resp = await this.request
|
||||
.post(`/api/${tableId}/rows`)
|
||||
.send(row)
|
||||
.set(this.config.defaultHeaders())
|
||||
.expect("Content-Type", /json/)
|
||||
if (resp.status !== expectStatus) {
|
||||
throw new Error(
|
||||
`Expected status ${expectStatus} but got ${
|
||||
resp.status
|
||||
}, body: ${JSON.stringify(resp.body)}`
|
||||
)
|
||||
}
|
||||
return resp.body as Row
|
||||
return await this._post<Row>(`/api/${tableId}/rows`, {
|
||||
body: row,
|
||||
expectations,
|
||||
})
|
||||
}
|
||||
|
||||
validate = async (
|
||||
|
|
Loading…
Reference in New Issue