Another test case.

This commit is contained in:
mike12345567 2024-10-22 15:03:47 +01:00
parent cf3ef64734
commit ebc440a0b6
2 changed files with 28 additions and 12 deletions

View File

@ -321,6 +321,23 @@ describe("/roles", () => {
} }
) )
}) })
it("should fetch preview role correctly even without basic specified", async () => {
const role = await config.api.roles.save(basicRole())
// have to forcefully delete the inherits from DB - technically can't
// happen anymore - but good test case
await dbCore.getDB(config.appId!).put({
...role,
_id: dbCore.prefixRoleID(role._id!),
inherits: [],
})
await config.withHeaders({ "x-budibase-role": role.name }, async () => {
const res = await config.api.roles.accessible({
status: 200,
})
expect(res).toEqual([role.name])
})
})
}) })
describe("accessible - multi-inheritance", () => { describe("accessible - multi-inheritance", () => {

View File

@ -8,31 +8,31 @@ import {
} from "../../automations" } from "../../automations"
import { import {
AIOperationEnum, AIOperationEnum,
AutoFieldSubType,
Automation, Automation,
AutomationActionStepId, AutomationActionStepId,
AutomationEventType,
AutomationResults, AutomationResults,
AutomationStatus, AutomationStatus,
AutomationStep, AutomationStep,
AutomationStepType, AutomationStepType,
AutomationTrigger, AutomationTrigger,
AutomationTriggerStepId, AutomationTriggerStepId,
BBReferenceFieldSubType,
CreateViewRequest,
Datasource, Datasource,
FieldSchema,
FieldType, FieldType,
INTERNAL_TABLE_SOURCE_ID,
JsonFieldSubType,
LoopStepType,
Query,
Role,
SourceName, SourceName,
Table, Table,
INTERNAL_TABLE_SOURCE_ID,
TableSourceType, TableSourceType,
Query,
Webhook, Webhook,
WebhookActionType, WebhookActionType,
AutomationEventType,
LoopStepType,
FieldSchema,
BBReferenceFieldSubType,
JsonFieldSubType,
AutoFieldSubType,
Role,
CreateViewRequest,
} from "@budibase/types" } from "@budibase/types"
import { LoopInput } from "../../definitions/automations" import { LoopInput } from "../../definitions/automations"
import { merge } from "lodash" import { merge } from "lodash"
@ -439,7 +439,7 @@ export function updateRowAutomationWithFilters(
appId: string, appId: string,
tableId: string tableId: string
): Automation { ): Automation {
const automation: Automation = { return {
name: "updateRowWithFilters", name: "updateRowWithFilters",
type: "automation", type: "automation",
appId, appId,
@ -472,7 +472,6 @@ export function updateRowAutomationWithFilters(
}, },
}, },
} }
return automation
} }
export function basicAutomationResults( export function basicAutomationResults(