Fix tests

This commit is contained in:
Adria Navarro 2024-05-27 14:31:45 +02:00
parent 1eb929736c
commit 422b1e2753
2 changed files with 100 additions and 85 deletions

View File

@ -106,6 +106,10 @@ export const useViewPermissions = () => {
return useFeature(Feature.VIEW_PERMISSIONS)
}
export const useViewReadonlyColumns = () => {
return useFeature(Feature.VIEW_READONLY_COLUMNS)
}
// QUOTAS
export const setAutomationLogsQuota = (value: number) => {

View File

@ -104,6 +104,10 @@ describe.each([
setup.afterAll()
})
beforeEach(() => {
mocks.licenses.useCloudFree()
})
const getRowUsage = async () => {
const { total } = await config.doInContext(undefined, () =>
quotas.getCurrentUsageValues(QuotaUsageType.STATIC, StaticQuotaName.ROWS)
@ -269,6 +273,10 @@ describe.each([
})
})
describe("readonly fields", () => {
beforeEach(() => {
mocks.licenses.useViewReadonlyColumns()
})
it("readonly fields are persisted", async () => {
const table = await config.api.table.save(
saveTableRequest({
@ -345,7 +353,8 @@ describe.each([
await config.api.viewV2.create(newView, {
status: 400,
body: {
message: 'Field "name" cannot be readonly as it is a required field',
message:
'Field "name" cannot be readonly as it is a required field',
status: 400,
},
})
@ -387,6 +396,7 @@ describe.each([
})
})
})
})
describe("update", () => {
let view: ViewV2
@ -423,6 +433,7 @@ describe.each([
})
it("can update all fields", async () => {
mocks.licenses.useViewReadonlyColumns()
const tableId = table._id!
const updatedData: Required<UpdateViewRequest> = {