1
0
Fork 0
mirror of synced 2024-10-04 12:03:31 +13:00

Fix relation get test to test expected behaviour

This commit is contained in:
adrinr 2023-02-21 09:42:56 +00:00
parent 0ee77aa9b0
commit 3c5d5f4c25

View file

@ -419,14 +419,16 @@ describe("row api - postgres", () => {
describe("given a row with relation data", () => {
let row: Row
let foreignRow: Row
beforeEach(async () => {
let [createdRow] = await populatePrimaryRows(1, {
createForeignRow: true,
})
row = createdRow.row
foreignRow = createdRow.foreignRow!
})
it("foreign key fields are not retrieved", async () => {
it("only foreign keys are retrieved", async () => {
const res = await getRow(primaryPostgresTable._id, row.id)
expect(res.status).toBe(200)
@ -436,7 +438,12 @@ describe("row api - postgres", () => {
_id: expect.any(String),
_rev: expect.any(String),
})
expect(res.body.foreignField).toBeUndefined()
expect(
res.body[`fk_${auxPostgresTable.name}_foreignField`]
).toBeDefined()
expect(res.body[`fk_${auxPostgresTable.name}_foreignField`]).toBe(
foreignRow.id
)
})
})
})