Fixing test cases.
This commit is contained in:
parent
5a0ef45c29
commit
29817892a8
|
@ -82,7 +82,7 @@ describe("/datasources", () => {
|
|||
entityId: "users",
|
||||
},
|
||||
resource: {
|
||||
fields: ["name", "age"],
|
||||
fields: ["users.name", "users.age"],
|
||||
},
|
||||
filters: {
|
||||
string: {
|
||||
|
@ -94,7 +94,7 @@ describe("/datasources", () => {
|
|||
.expect(200)
|
||||
// this is mock data, can't test it
|
||||
expect(res.body).toBeDefined()
|
||||
expect(pg.queryMock).toHaveBeenCalledWith(`select "name", "age" from "users" where "users"."name" like $1 limit $2`, ["John%", 5000])
|
||||
expect(pg.queryMock).toHaveBeenCalledWith(`select "users"."name" as "users.name", "users"."age" as "users.age" from "users" where "users"."name" like $1 limit $2`, ["John%", 5000])
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -62,12 +62,13 @@ describe("SQL query builder", () => {
|
|||
})
|
||||
|
||||
it("should test a read with specific columns", () => {
|
||||
const nameProp = `${TABLE_NAME}.name`, ageProp = `${TABLE_NAME}.age`
|
||||
const query = sql._query(generateReadJson({
|
||||
fields: ["name", "age"]
|
||||
fields: [nameProp, ageProp]
|
||||
}))
|
||||
expect(query).toEqual({
|
||||
bindings: [limit],
|
||||
sql: `select "name", "age" from "${TABLE_NAME}" limit $1`
|
||||
sql: `select "${TABLE_NAME}"."name" as "${nameProp}", "${TABLE_NAME}"."age" as "${ageProp}" from "${TABLE_NAME}" limit $1`
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue