1
0
Fork 0
mirror of synced 2024-08-09 15:17:57 +12:00

Fix tests

This commit is contained in:
Adria Navarro 2023-09-13 12:23:59 +02:00
parent ceb3129e22
commit 6bae382d81
2 changed files with 11 additions and 2 deletions

View file

@ -78,9 +78,9 @@ export async function save(ctx: UserCtx<SaveTableRequest, SaveTableResponse>) {
ctx.status = 200
ctx.message = `Table ${table.name} saved successfully.`
ctx.eventEmitter &&
ctx.eventEmitter.emitTable(`table:save`, appId, savedTable)
ctx.eventEmitter.emitTable(`table:save`, appId, { ...savedTable })
ctx.body = savedTable
builderSocket?.emitTableUpdate(ctx, savedTable)
builderSocket?.emitTableUpdate(ctx, { ...savedTable })
}
export async function destroy(ctx: UserCtx) {

View file

@ -557,6 +557,11 @@ class TestConfiguration {
return this.updateTable(config, options)
}
async getTable(tableId?: string) {
tableId = tableId || this.table!._id!
return this._req(null, { tableId }, controllers.table.find)
}
async createLinkedTable(
config?: Table,
relationshipType = RelationshipType.ONE_TO_MANY,
@ -607,6 +612,10 @@ class TestConfiguration {
return this.api.row.save(tableId!, config)
}
async getRow(tableId: string, rowId: string): Promise<Row> {
return this._req(null, { tableId, rowId }, controllers.row.find)
}
async getRows(tableId: string) {
if (!tableId && this.table) {
tableId = this.table._id!