feat: migrate frontend app to nextjs app router

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2023-05-29 17:32:44 +02:00
parent 5b5dabc84e
commit 8602645bea
108 changed files with 893 additions and 1188 deletions

View file

@ -1,47 +0,0 @@
/*
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
describe('Opengraph metadata', () => {
beforeEach(() => {
cy.visitTestNote()
})
it('includes the note title if not overridden', () => {
cy.setCodemirrorContent('---\ntitle: Test title\n---')
cy.get('meta[property="og:title"]').should('have.attr', 'content', 'Test title')
})
it('includes the note title if overridden', () => {
cy.setCodemirrorContent('---\ntitle: Test title\nopengraph:\n title: Overridden title\n---')
cy.get('meta[property="og:title"]').should('have.attr', 'content', 'Overridden title')
})
it('includes custom opengraph tags', () => {
cy.setCodemirrorContent('---\nopengraph:\n image: https://dummyimage.com/48\n---')
cy.get('meta[property="og:image"]').should('have.attr', 'content', 'https://dummyimage.com/48')
})
})
describe('License frontmatter', () => {
beforeEach(() => {
cy.visitTestNote()
})
it('sets the link tag if defined and not blank', () => {
cy.setCodemirrorContent('---\nlicense: https://example.com\n---')
cy.get('link[rel="license"]').should('have.attr', 'href', 'https://example.com')
})
it('does not set the link tag if not defined', () => {
cy.setCodemirrorContent('---\ntitle: No license for this note\n---')
cy.get('link[rel="license"]').should('not.exist')
})
it('does not set the link tag if defined but blank', () => {
cy.setCodemirrorContent('---\nlicense: \n---')
cy.get('link[rel="license"]').should('not.exist')
})
})

View file

@ -4,6 +4,7 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { AuthProviderType } from '../../src/api/config/types'
import { HttpMethod } from '../../src/handler-utils/respond-to-matching-request'
declare namespace Cypress {
interface Chainable {
@ -80,13 +81,7 @@ export const config = {
}
Cypress.Commands.add('loadConfig', (additionalConfig?: Partial<typeof config>) => {
return cy.intercept('/api/private/config', {
statusCode: 200,
body: {
...config,
...additionalConfig
}
})
return cy.request(HttpMethod.POST, '/api/private/config', { ...config, ...additionalConfig })
})
beforeEach(() => {