Add extra tests
This commit is contained in:
parent
0831b7cf3f
commit
645abea2cd
|
@ -85,7 +85,7 @@ describe("/rowsActions", () => {
|
|||
})
|
||||
})
|
||||
|
||||
it("can create multiple row actions for the same tables", async () => {
|
||||
it("can create multiple row actions for the same table", async () => {
|
||||
const rowActions = generator.unique(() => createRowActionRequest(), 3)
|
||||
|
||||
await config.api.rowAction.save(tableId, rowActions[0], {
|
||||
|
@ -108,6 +108,41 @@ describe("/rowsActions", () => {
|
|||
})
|
||||
})
|
||||
|
||||
it("can create row actions for different tables", async () => {
|
||||
const otherTable = await config.api.table.save(
|
||||
setup.structures.basicTable()
|
||||
)
|
||||
const otherTableId = otherTable._id!
|
||||
|
||||
const rowAction1 = createRowActionRequest()
|
||||
const rowAction2 = createRowActionRequest()
|
||||
|
||||
const res1 = await config.api.rowAction.save(tableId, rowAction1, {
|
||||
status: 201,
|
||||
})
|
||||
const res2 = await config.api.rowAction.save(otherTableId, rowAction2, {
|
||||
status: 201,
|
||||
})
|
||||
|
||||
expect(res1).toEqual({
|
||||
_id: `${tableId}_row_actions`,
|
||||
_rev: expect.stringMatching(/^1-\w+/),
|
||||
actions: [rowAction1],
|
||||
tableId: tableId,
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
})
|
||||
|
||||
expect(res2).toEqual({
|
||||
_id: `${otherTableId}_row_actions`,
|
||||
_rev: expect.stringMatching(/^1-\w+/),
|
||||
actions: [rowAction2],
|
||||
tableId: otherTableId,
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
})
|
||||
})
|
||||
|
||||
it("rejects with bad request when creating with no name", async () => {
|
||||
const rowAction: CreateRowActionRequest = {
|
||||
name: "",
|
||||
|
|
Loading…
Reference in New Issue