Fix view test

This commit is contained in:
Adria Navarro 2023-09-12 09:52:46 +02:00
parent 55514653c3
commit c70c627fc9
1 changed files with 29 additions and 8 deletions

View File

@ -471,7 +471,12 @@ describe.each([
function orderTable(): Table {
return {
name: "orders",
primary: ["id"],
schema: {
id: {
type: FieldType.AUTO,
name: "id",
},
Country: {
type: FieldType.STRING,
name: "Country",
@ -494,19 +499,35 @@ describe.each([
const createViewResponse = await config.api.viewV2.create({
tableId: table._id,
schema: {
Country: {},
OrderID: {},
Country: {
visible: true,
},
OrderID: {
visible: true,
},
},
})
const response = await config.api.row.save(createViewResponse.id, {
Country: "Aussy",
const createRowResponse = await config.api.row.save(
createViewResponse.id,
{
OrderID: "1111",
Country: "Aussy",
Story: "aaaaa",
})
}
)
const row = await config.api.row.get(table._id!, response._id!)
const row = await config.api.row.get(table._id!, createRowResponse._id!)
expect(row.body.Story).toBeUndefined()
expect(row.body).toEqual({
...defaultRowFields,
OrderID: "1111",
Country: "Aussy",
id: 1,
_id: "%5B1%5D",
_rev: createRowResponse._rev,
tableId: table._id,
})
})
})