refactor(common): extract frontmatter code into commons

Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Philip Molares 2023-03-26 12:30:16 +02:00 committed by Tilman Vatteroth
parent 8bd7fd1be8
commit 8e57188ab5
7 changed files with 14 additions and 8 deletions

View file

@ -7,10 +7,10 @@ import type { Config } from '../api/config/types'
import type { HistoryEntryWithOrigin } from '../api/history/types'
import type { DarkModeConfig } from './dark-mode/types'
import type { EditorConfig } from './editor/types'
import type { NoteDetails } from './note-details/types/note-details'
import type { RealtimeStatus } from './realtime/types'
import type { RendererStatus } from './renderer-status/types'
import type { OptionalUserState } from './user/types'
import type { NoteDetails } from '@hedgedoc/commons'
export interface ApplicationState {
user: OptionalUserState

View file

@ -7,9 +7,14 @@ import { initialState } from '../initial-state'
import { buildStateFromFirstHeadingUpdate } from './build-state-from-first-heading-update'
// noinspection JSUnusedGlobalSymbols
jest.mock('../generate-note-title', () => ({
generateNoteTitle: () => 'generated title'
}))
jest.mock(
'@hedgedoc/commons',
() =>
({
...jest.requireActual('@hedgedoc/commons'),
generateNoteTitle: () => 'generated title'
} as Record<string, unknown>)
)
describe('build state from first heading update', () => {
it('generates a new state with the given first heading', () => {

View file

@ -7,8 +7,8 @@ import type { Note } from '../../../api/notes/types'
import * as buildStateFromUpdatedMarkdownContentModule from '../build-state-from-updated-markdown-content'
import { initialSlideOptions } from '../initial-state'
import type { NoteDetails } from '../types/note-details'
import { NoteTextDirection, NoteType } from '../types/note-details'
import { buildStateFromServerDto } from './build-state-from-set-note-data-from-server'
import { NoteTextDirection, NoteType } from '@hedgedoc/commons'
import { DateTime } from 'luxon'
import { Mock } from 'ts-mockery'