1
0
Fork 0
mirror of synced 2024-08-06 13:48:14 +12:00

Add license tests

This commit is contained in:
Adria Navarro 2024-05-27 14:44:00 +02:00
parent 422b1e2753
commit 9e4c575d79

View file

@ -277,6 +277,7 @@ describe.each([
beforeEach(() => {
mocks.licenses.useViewReadonlyColumns()
})
it("readonly fields are persisted", async () => {
const table = await config.api.table.save(
saveTableRequest({
@ -395,6 +396,43 @@ describe.each([
},
})
})
it("readonly fields cannot be used on free license", async () => {
mocks.licenses.useCloudFree()
const table = await config.api.table.save(
saveTableRequest({
schema: {
name: {
name: "name",
type: FieldType.STRING,
},
description: {
name: "description",
type: FieldType.STRING,
},
},
})
)
const newView: CreateViewRequest = {
name: generator.name(),
tableId: table._id!,
schema: {
name: {
visible: true,
readonly: true,
},
},
}
await config.api.viewV2.create(newView, {
status: 400,
body: {
message: "Readonly fields are not enabled for your tenant",
status: 400,
},
})
})
})
})
@ -638,6 +676,28 @@ describe.each([
}
)
})
it("cannot update views with readonly on on free license", async () => {
mocks.licenses.useViewReadonlyColumns()
view = await config.api.viewV2.update({
...view,
schema: {
Price: {
visible: true,
readonly: true,
},
},
})
mocks.licenses.useCloudFree()
await config.api.viewV2.create(view, {
status: 400,
body: {
message: "Readonly fields are not enabled for your tenant",
},
})
})
})
describe("delete", () => {
@ -686,8 +746,10 @@ describe.each([
})
describe("read", () => {
it("views have extra data trimmed", async () => {
const table = await config.api.table.save(
let view: ViewV2
beforeAll(async () => {
table = await config.api.table.save(
saveTableRequest({
schema: {
Country: {
@ -702,7 +764,7 @@ describe.each([
})
)
const view = await config.api.viewV2.create({
view = await config.api.viewV2.create({
tableId: table._id!,
name: generator.guid(),
schema: {
@ -711,7 +773,9 @@ describe.each([
},
},
})
})
it("views have extra data trimmed", async () => {
let row = await config.api.row.save(view.id, {
Country: "Aussy",
Story: "aaaaa",