Update URLs to use builder instead of _builder

This commit is contained in:
Andrew Kingston 2021-04-01 10:06:22 +01:00
parent 32e7a7950b
commit 86667bfa0f
8 changed files with 20 additions and 22 deletions

View File

@ -1,5 +1,5 @@
{
"baseUrl": "http://localhost:4001/_builder/",
"baseUrl": "http://localhost:4001/builder/",
"video": true,
"projectId": "bmbemn",
"env": {

View File

@ -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")
})
})

View File

@ -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) {

View File

@ -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": {

View File

@ -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

View File

@ -11,7 +11,7 @@ const {
} = require("../utilities")
module.exports = async (ctx, next) => {
if (ctx.path === "/_builder") {
if (ctx.path === "/builder") {
await next()
return
}

View File

@ -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,7 +59,7 @@ 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")
@ -70,14 +70,13 @@ describe("Authenticated middleware", () => {
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",
})
})