Update URLs to use builder instead of _builder
This commit is contained in:
parent
32e7a7950b
commit
86667bfa0f
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"baseUrl": "http://localhost:4001/_builder/",
|
||||
"baseUrl": "http://localhost:4001/builder/",
|
||||
"video": true,
|
||||
"projectId": "bmbemn",
|
||||
"env": {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
context("Create an Application", () => {
|
||||
it("should create a new application", () => {
|
||||
cy.createTestApp()
|
||||
cy.visit(`localhost:${Cypress.env("PORT")}/_builder`)
|
||||
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
|
||||
cy.contains("Cypress Tests").should("exist")
|
||||
})
|
||||
})
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
|
||||
|
||||
Cypress.Commands.add("createApp", name => {
|
||||
cy.visit(`localhost:${Cypress.env("PORT")}/_builder`)
|
||||
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
|
||||
cy.contains("Create New Web App").click()
|
||||
cy.get("body")
|
||||
.then($body => {
|
||||
|
@ -56,7 +56,7 @@ Cypress.Commands.add("createApp", name => {
|
|||
})
|
||||
|
||||
Cypress.Commands.add("deleteApp", name => {
|
||||
cy.visit(`localhost:${Cypress.env("PORT")}/_builder`)
|
||||
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
|
||||
cy.get("body").then($body => {
|
||||
cy.wait(1000)
|
||||
if ($body.find(`[data-cy="app-${name}"]`).length) {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
"version": "0.8.9",
|
||||
"license": "AGPL-3.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "routify -b && vite build",
|
||||
"start": "routify -c rollup",
|
||||
|
@ -16,8 +15,8 @@
|
|||
"cy:run": "cypress run",
|
||||
"cy:open": "cypress open",
|
||||
"cy:run:ci": "cypress run --browser electron --record --key f308590b-6070-41af-b970-794a3823d451",
|
||||
"cy:test": "start-server-and-test cy:setup http://localhost:4001/_builder cy:run",
|
||||
"cy:ci": "start-server-and-test cy:setup http://localhost:4001/_builder cy:run:ci"
|
||||
"cy:test": "start-server-and-test cy:setup http://localhost:4001/builder cy:run",
|
||||
"cy:ci": "start-server-and-test cy:setup http://localhost:4001/builder cy:run:ci"
|
||||
},
|
||||
"jest": {
|
||||
"globals": {
|
||||
|
|
|
@ -64,6 +64,6 @@ for (let route of mainRoutes) {
|
|||
router.use(staticRoutes.routes())
|
||||
router.use(staticRoutes.allowedMethods())
|
||||
|
||||
router.redirect("/", "/_builder")
|
||||
router.redirect("/", "/builder")
|
||||
|
||||
module.exports = router
|
||||
|
|
|
@ -11,7 +11,7 @@ const {
|
|||
} = require("../utilities")
|
||||
|
||||
module.exports = async (ctx, next) => {
|
||||
if (ctx.path === "/_builder") {
|
||||
if (ctx.path === "/builder") {
|
||||
await next()
|
||||
return
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const { AuthTypes } = require("../../constants")
|
||||
const authenticatedMiddleware = require("../authenticated")
|
||||
const authenticatedMiddleware = require("../authenticated")
|
||||
const jwt = require("jsonwebtoken")
|
||||
jest.mock("jsonwebtoken")
|
||||
|
||||
|
@ -11,15 +11,15 @@ class TestConfiguration {
|
|||
auth: {},
|
||||
cookies: {
|
||||
set: jest.fn(),
|
||||
get: jest.fn()
|
||||
get: jest.fn(),
|
||||
},
|
||||
headers: {},
|
||||
params: {},
|
||||
path: "",
|
||||
request: {
|
||||
headers: {}
|
||||
headers: {},
|
||||
},
|
||||
throw: jest.fn()
|
||||
throw: jest.fn(),
|
||||
}
|
||||
this.next = jest.fn()
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ describe("Authenticated middleware", () => {
|
|||
})
|
||||
|
||||
it("calls next() when on the builder path", async () => {
|
||||
config.ctx.path = "/_builder"
|
||||
config.ctx.path = "/builder"
|
||||
|
||||
await config.executeMiddleware()
|
||||
|
||||
|
@ -59,25 +59,24 @@ describe("Authenticated middleware", () => {
|
|||
it("sets a new cookie when the current cookie does not match the app id from context", async () => {
|
||||
const appId = "app_123"
|
||||
config.setHeaders({
|
||||
"x-budibase-app-id": appId
|
||||
"x-budibase-app-id": appId,
|
||||
})
|
||||
config.ctx.cookies.get.mockImplementation(() => "cookieAppId")
|
||||
|
||||
await config.executeMiddleware()
|
||||
|
||||
expect(config.ctx.cookies.set).toHaveBeenCalledWith(
|
||||
"budibase:currentapp:local",
|
||||
"budibase:currentapp:local",
|
||||
appId,
|
||||
expect.any(Object)
|
||||
)
|
||||
|
||||
})
|
||||
|
||||
it("sets the correct BUILDER auth type information when the x-budibase-type header is not 'client'", async () => {
|
||||
config.ctx.cookies.get.mockImplementation(() => "budibase:builder:local")
|
||||
jwt.verify.mockImplementationOnce(() => ({
|
||||
apiKey: "1234",
|
||||
roleId: "BUILDER"
|
||||
roleId: "BUILDER",
|
||||
}))
|
||||
|
||||
await config.executeMiddleware()
|
||||
|
@ -88,12 +87,12 @@ describe("Authenticated middleware", () => {
|
|||
|
||||
it("sets the correct APP auth type information when the user is not in the builder", async () => {
|
||||
config.setHeaders({
|
||||
"x-budibase-type": "client"
|
||||
"x-budibase-type": "client",
|
||||
})
|
||||
config.ctx.cookies.get.mockImplementation(() => `budibase:app:local`)
|
||||
jwt.verify.mockImplementationOnce(() => ({
|
||||
apiKey: "1234",
|
||||
roleId: "ADMIN"
|
||||
roleId: "ADMIN",
|
||||
}))
|
||||
|
||||
await config.executeMiddleware()
|
||||
|
@ -108,7 +107,7 @@ describe("Authenticated middleware", () => {
|
|||
expect(config.ctx.user.role).toEqual({
|
||||
_id: "PUBLIC",
|
||||
name: "Public",
|
||||
permissionId: "public"
|
||||
permissionId: "public",
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -122,4 +121,4 @@ describe("Authenticated middleware", () => {
|
|||
|
||||
expect(config.ctx.cookies.set).toBeCalledWith("budibase:builder:local")
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue