@budibase/worker 2.8.31-alpha.0 → 2.8.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,62 +0,0 @@
1
- import { TestConfiguration, structures } from "../../../../tests"
2
- import { mocks } from "@budibase/backend-core/tests"
3
- import { User } from "@budibase/types"
4
-
5
- const MOCK_APP_ID = "app_a"
6
-
7
- describe("/api/global/users/:userId/app/builder", () => {
8
- const config = new TestConfiguration()
9
-
10
- beforeAll(async () => {
11
- await config.beforeAll()
12
- })
13
-
14
- afterAll(async () => {
15
- await config.afterAll()
16
- })
17
-
18
- async function newUser() {
19
- const base = structures.users.user()
20
- return await config.createUser(base)
21
- }
22
-
23
- async function getUser(userId: string) {
24
- const response = await config.api.users.getUser(userId)
25
- return response.body as User
26
- }
27
-
28
- describe("Confirm pro license", () => {
29
- it("should 400 with licensing", async () => {
30
- const user = await newUser()
31
- const resp = await config.api.users.grantBuilderToApp(
32
- user._id!,
33
- MOCK_APP_ID,
34
- 400
35
- )
36
- expect(resp.body.message).toContain("Feature not enabled")
37
- })
38
- })
39
-
40
- describe("PATCH /api/global/users/:userId/app/:appId/builder", () => {
41
- it("should be able to grant a user access to a particular app", async () => {
42
- mocks.licenses.useAppBuilders()
43
- const user = await newUser()
44
- await config.api.users.grantBuilderToApp(user._id!, MOCK_APP_ID)
45
- const updated = await getUser(user._id!)
46
- expect(updated.builder?.apps![0]).toBe(MOCK_APP_ID)
47
- })
48
- })
49
-
50
- describe("DELETE /api/global/users/:userId/app/:appId/builder", () => {
51
- it("should allow revoking access", async () => {
52
- mocks.licenses.useAppBuilders()
53
- const user = await newUser()
54
- await config.api.users.grantBuilderToApp(user._id!, MOCK_APP_ID)
55
- let updated = await getUser(user._id!)
56
- expect(updated.builder?.apps![0]).toBe(MOCK_APP_ID)
57
- await config.api.users.revokeBuilderFromApp(user._id!, MOCK_APP_ID)
58
- updated = await getUser(user._id!)
59
- expect(updated.builder?.apps!.length).toBe(0)
60
- })
61
- })
62
- })
@@ -1,9 +0,0 @@
1
- import Router from "@koa/router"
2
- import { middleware } from "@budibase/backend-core"
3
- import * as controller from "../../controllers/system/logs"
4
-
5
- const router: Router = new Router()
6
-
7
- router.get("/api/system/logs", middleware.adminOnly, controller.getLogs)
8
-
9
- export default router