Migrate RowAPI.patch

This commit is contained in:
Sam Rose 2024-03-01 16:40:47 +00:00
parent 58b1c2bca6
commit 4efafaeeaf
No known key found for this signature in database
1 changed files with 5 additions and 14 deletions

View File

@ -60,21 +60,12 @@ export class RowAPI extends TestAPI {
patch = async ( patch = async (
sourceId: string, sourceId: string,
row: PatchRowRequest, row: PatchRowRequest,
{ expectStatus } = { expectStatus: 200 } expectations?: Expectations
): Promise<Row> => { ): Promise<Row> => {
let resp = await this.request return await this._patch<Row>(`/api/${sourceId}/rows`, {
.patch(`/api/${sourceId}/rows`) body: row,
.send(row) expectations,
.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
} }
delete = async ( delete = async (