Set order to the tests

This commit is contained in:
Adria Navarro 2023-07-24 15:05:20 +02:00
parent 0f53fa14ad
commit 8e904cea13
1 changed files with 59 additions and 0 deletions

View File

@ -15,6 +15,7 @@ describe("table sdk", () => {
name: "name", name: "name",
visible: true, visible: true,
width: 80, width: 80,
order: 2,
constraints: { constraints: {
type: "string", type: "string",
}, },
@ -32,6 +33,7 @@ describe("table sdk", () => {
type: FieldType.NUMBER, type: FieldType.NUMBER,
name: "id", name: "id",
visible: true, visible: true,
order: 1,
constraints: { constraints: {
type: "number", type: "number",
}, },
@ -70,6 +72,7 @@ describe("table sdk", () => {
type: "string", type: "string",
name: "name", name: "name",
visible: true, visible: true,
order: 2,
width: 80, width: 80,
constraints: { constraints: {
type: "string", type: "string",
@ -88,6 +91,7 @@ describe("table sdk", () => {
type: "number", type: "number",
name: "id", name: "id",
visible: true, visible: true,
order: 1,
constraints: { constraints: {
type: "number", type: "number",
}, },
@ -136,6 +140,7 @@ describe("table sdk", () => {
type: "string", type: "string",
name: "name", name: "name",
visible: true, visible: true,
order: 2,
width: 80, width: 80,
constraints: { constraints: {
type: "string", type: "string",
@ -145,6 +150,7 @@ describe("table sdk", () => {
type: "number", type: "number",
name: "id", name: "id",
visible: true, visible: true,
order: 1,
constraints: { constraints: {
type: "number", type: "number",
}, },
@ -181,6 +187,7 @@ describe("table sdk", () => {
name: { name: {
type: "string", type: "string",
name: "name", name: "name",
order: 2,
visible: true, visible: true,
width: 80, width: 80,
constraints: { constraints: {
@ -193,6 +200,58 @@ describe("table sdk", () => {
}) })
) )
}) })
it("if view schema only defines visiblility, should only fetch the selected fields", async () => {
const tableId = basicTable._id!
const view: ViewV2 = {
version: 2,
id: generator.guid(),
name: generator.guid(),
tableId,
columns: {
name: { visible: true },
id: { visible: true },
description: { visible: false },
},
}
const res = sdk.tables.enrichViewSchemas({
...basicTable,
views: { [view.name]: view },
})
expect(res).toEqual(
expect.objectContaining({
...basicTable,
views: {
[view.name]: {
...view,
schema: {
name: {
type: "string",
name: "name",
order: 2,
visible: true,
width: 80,
constraints: {
type: "string",
},
},
id: {
type: "number",
name: "id",
order: 1,
visible: true,
constraints: {
type: "number",
},
},
},
},
},
})
)
})
}) })
}) })
}) })