Update view tests

This commit is contained in:
Andrew Kingston 2023-08-25 15:50:29 +01:00
parent e82c08ea3e
commit 100c6450dc
1 changed files with 30 additions and 31 deletions

View File

@ -121,25 +121,21 @@ describe("table sdk", () => {
expect(res).toEqual({ expect(res).toEqual({
...view, ...view,
schema: { schema: {
...basicTable.schema,
name: { name: {
type: "string", ...basicTable.schema.name,
name: "name",
visible: true, visible: true,
order: 2, },
width: 80, description: {
constraints: { ...basicTable.schema.description,
type: "string", visible: false,
},
}, },
id: { id: {
type: "number", ...basicTable.schema.id,
name: "id",
visible: true, visible: true,
order: 1, },
constraints: { hiddenField: {
type: "number", ...basicTable.schema.hiddenField,
}, visible: false,
}, },
}, },
}) })
@ -160,24 +156,27 @@ describe("table sdk", () => {
const res = enrichSchema(view, basicTable.schema) const res = enrichSchema(view, basicTable.schema)
expect(res).toEqual( expect(res).toEqual({
expect.objectContaining({ ...view,
...view, schema: {
schema: { name: {
...basicTable.schema, ...basicTable.schema.name,
name: { visible: true,
type: "string",
name: "name",
order: 2,
visible: true,
width: 80,
constraints: {
type: "string",
},
},
}, },
}) description: {
) ...basicTable.schema.description,
visible: false,
},
id: {
...basicTable.schema.id,
visible: false,
},
hiddenField: {
...basicTable.schema.hiddenField,
visible: false,
},
},
})
}) })
it("if the view schema overrides the schema UI, the table schema should be overridden", async () => { it("if the view schema overrides the schema UI, the table schema should be overridden", async () => {