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