mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-28 05:54:43 -04:00
Refactor handling of environment variables (#2303)
* Refactor environment variables Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
e412115a78
commit
39a4125cb0
85 changed files with 624 additions and 461 deletions
|
@ -12,7 +12,7 @@ describe('Delete note', () => {
|
|||
})
|
||||
|
||||
it('correctly deletes a note', () => {
|
||||
cy.intercept('DELETE', `/api/mock-backend/private/notes/${testNoteId}`, {
|
||||
cy.intercept('DELETE', `api/private/notes/${testNoteId}`, {
|
||||
statusCode: 204
|
||||
})
|
||||
cy.getByCypressId('sidebar.deleteNote.button').click()
|
||||
|
|
|
@ -17,7 +17,7 @@ describe('File upload', () => {
|
|||
cy.intercept(
|
||||
{
|
||||
method: 'POST',
|
||||
url: '/api/mock-backend/private/media'
|
||||
url: 'api/private/media'
|
||||
},
|
||||
{
|
||||
statusCode: 201,
|
||||
|
@ -74,7 +74,7 @@ describe('File upload', () => {
|
|||
cy.intercept(
|
||||
{
|
||||
method: 'POST',
|
||||
url: '/api/mock-backend/private/media'
|
||||
url: 'api/private/media'
|
||||
},
|
||||
{
|
||||
statusCode: 400
|
||||
|
|
|
@ -24,7 +24,7 @@ describe('History', () => {
|
|||
describe('is as given when not empty', () => {
|
||||
beforeEach(() => {
|
||||
cy.clearLocalStorage('history')
|
||||
cy.intercept('GET', '/api/mock-backend/private/me/history', {
|
||||
cy.intercept('GET', 'api/private/me/history', {
|
||||
body: [
|
||||
{
|
||||
identifier: 'cypress',
|
||||
|
@ -51,7 +51,7 @@ describe('History', () => {
|
|||
describe('is untitled when not empty', () => {
|
||||
beforeEach(() => {
|
||||
cy.clearLocalStorage('history')
|
||||
cy.intercept('GET', '/api/mock-backend/private/me/history', {
|
||||
cy.intercept('GET', 'api/private/me/history', {
|
||||
body: [
|
||||
{
|
||||
identifier: 'cypress-no-title',
|
||||
|
@ -84,7 +84,7 @@ describe('History', () => {
|
|||
|
||||
describe('working', () => {
|
||||
beforeEach(() => {
|
||||
cy.intercept('PUT', '/api/mock-backend/private/me/history/features', (req) => {
|
||||
cy.intercept('PUT', 'api/private/me/history/features', (req) => {
|
||||
req.reply(200, req.body)
|
||||
})
|
||||
})
|
||||
|
@ -106,7 +106,7 @@ describe('History', () => {
|
|||
|
||||
describe('failing', () => {
|
||||
beforeEach(() => {
|
||||
cy.intercept('PUT', '/api/mock-backend/private/me/history/features', {
|
||||
cy.intercept('PUT', 'api/private/me/history/features', {
|
||||
statusCode: 401
|
||||
})
|
||||
})
|
||||
|
@ -128,7 +128,7 @@ describe('History', () => {
|
|||
describe('Import', () => {
|
||||
beforeEach(() => {
|
||||
cy.clearLocalStorage('history')
|
||||
cy.intercept('GET', '/api/mock-backend/private/me/history', {
|
||||
cy.intercept('GET', 'api/private/me/history', {
|
||||
body: []
|
||||
})
|
||||
cy.visitHistory()
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
describe('Intro page', () => {
|
||||
beforeEach(() => {
|
||||
cy.intercept('/mock-public/intro.md', 'test content')
|
||||
cy.intercept('public/intro.md', 'test content')
|
||||
cy.visitHome()
|
||||
})
|
||||
|
||||
|
@ -17,7 +17,7 @@ describe('Intro page', () => {
|
|||
})
|
||||
|
||||
it("won't show anything if no content was found", () => {
|
||||
cy.intercept('/mock-public/intro.md', {
|
||||
cy.intercept('public/intro.md', {
|
||||
statusCode: 404
|
||||
})
|
||||
cy.visitHome()
|
||||
|
|
|
@ -11,13 +11,13 @@ const motdMockHtml = 'This is the <strong>mock</strong> Motd call'
|
|||
|
||||
describe('Motd', () => {
|
||||
const mockExistingMotd = (useEtag?: boolean, content = motdMockContent) => {
|
||||
cy.intercept('GET', '/mock-public/motd.md', {
|
||||
cy.intercept('GET', 'public/motd.md', {
|
||||
statusCode: 200,
|
||||
headers: { [useEtag ? 'etag' : 'Last-Modified']: MOCK_LAST_MODIFIED },
|
||||
body: content
|
||||
})
|
||||
|
||||
cy.intercept('HEAD', '/mock-public/motd.md', {
|
||||
cy.intercept('HEAD', 'public/motd.md', {
|
||||
statusCode: 200,
|
||||
headers: { [useEtag ? 'etag' : 'Last-Modified']: MOCK_LAST_MODIFIED }
|
||||
})
|
||||
|
|
|
@ -8,7 +8,7 @@ describe('profile page', () => {
|
|||
beforeEach(() => {
|
||||
cy.intercept(
|
||||
{
|
||||
url: '/api/mock-backend/private/tokens',
|
||||
url: 'api/private/tokens',
|
||||
method: 'GET'
|
||||
},
|
||||
{
|
||||
|
@ -25,7 +25,7 @@ describe('profile page', () => {
|
|||
)
|
||||
cy.intercept(
|
||||
{
|
||||
url: '/api/mock-backend/private/tokens',
|
||||
url: 'api/private/tokens',
|
||||
method: 'POST'
|
||||
},
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ describe('profile page', () => {
|
|||
)
|
||||
cy.intercept(
|
||||
{
|
||||
url: '/api/mock-backend/private/tokens/cypress',
|
||||
url: 'api/private/tokens/cypress',
|
||||
method: 'DELETE'
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
@ -14,7 +14,7 @@ declare namespace Cypress {
|
|||
|
||||
export const branding = {
|
||||
name: 'DEMO Corp',
|
||||
logo: '/mock-public/img/demo.png'
|
||||
logo: 'public/img/demo.png'
|
||||
}
|
||||
|
||||
export const authProviders = [
|
||||
|
@ -77,15 +77,11 @@ export const config = {
|
|||
commit: 'MOCK'
|
||||
},
|
||||
plantumlServer: 'http://mock-plantuml.local',
|
||||
maxDocumentLength: 200,
|
||||
iframeCommunication: {
|
||||
editorOrigin: 'http://127.0.0.1:3001/',
|
||||
rendererOrigin: 'http://127.0.0.1:3001/'
|
||||
}
|
||||
maxDocumentLength: 200
|
||||
}
|
||||
|
||||
Cypress.Commands.add('loadConfig', (additionalConfig?: Partial<typeof config>) => {
|
||||
return cy.intercept('/api/mock-backend/private/config', {
|
||||
return cy.intercept('api/private/config', {
|
||||
statusCode: 200,
|
||||
body: {
|
||||
...config,
|
||||
|
@ -97,11 +93,11 @@ Cypress.Commands.add('loadConfig', (additionalConfig?: Partial<typeof config>) =
|
|||
beforeEach(() => {
|
||||
cy.loadConfig()
|
||||
|
||||
cy.intercept('GET', '/mock-public/motd.md', {
|
||||
cy.intercept('GET', 'public/motd.md', {
|
||||
body: '404 Not Found!',
|
||||
statusCode: 404
|
||||
})
|
||||
cy.intercept('HEAD', '/mock-public/motd.md', {
|
||||
cy.intercept('HEAD', 'public/motd.md', {
|
||||
statusCode: 404
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
export const testNoteId = 'test'
|
||||
|
||||
beforeEach(() => {
|
||||
cy.intercept(`/api/mock-backend/private/notes/${testNoteId}`, {
|
||||
cy.intercept(`api/private/notes/${testNoteId}`, {
|
||||
content: '',
|
||||
metadata: {
|
||||
id: testNoteId,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue