From 13ae9501019d08e2d9ef6f19df8d3f30e37c44c5 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 6 Mar 2023 15:31:27 +0000 Subject: [PATCH] Updating test case. --- .../routes/{ => public}/tests/metrics.spec.js | 21 +++---------------- 1 file changed, 3 insertions(+), 18 deletions(-) rename packages/server/src/api/routes/{ => public}/tests/metrics.spec.js (57%) diff --git a/packages/server/src/api/routes/tests/metrics.spec.js b/packages/server/src/api/routes/public/tests/metrics.spec.js similarity index 57% rename from packages/server/src/api/routes/tests/metrics.spec.js rename to packages/server/src/api/routes/public/tests/metrics.spec.js index 6e689f040a..8e226ec958 100644 --- a/packages/server/src/api/routes/tests/metrics.spec.js +++ b/packages/server/src/api/routes/public/tests/metrics.spec.js @@ -1,20 +1,7 @@ -const { roles, utils } = require("@budibase/backend-core") -const { checkBuilderEndpoint } = require("./utilities/TestFunctions") -const setup = require("./utilities") -const { BUILTIN_ROLE_IDS } = roles +const setup = require("../../tests/utilities") jest.setTimeout(30000) -// jest.mock("../../../utilities/workerRequests", () => ({ -// getGlobalUsers: jest.fn(() => { -// return {} -// }), -// getGlobalSelf: jest.fn(() => { -// return {} -// }), -// deleteGlobalUser: jest.fn(), -// })) - describe("/metrics", () => { let request = setup.getRequest() let config = setup.getConfig() @@ -36,13 +23,11 @@ describe("/metrics", () => { expect(res.text).toContain("budibase_tenant_user_count") }) - it("should apply authorization to endpoint", async () => { - // await config.createUser() - const res = await request + it("endpoint should not be publicly exposed", async () => { + await request .get(`/api/public/v1/metrics`) .set(config.publicHeaders()) .expect(403) - }) })