import { createDummies , Dummy , StringIdDummy , TextDummy , TypesDummy } from '../../../../test/helpers' ; import { Note , NoteSnippetTypes } from '../../../core/note' ; import { NoteContent , NoteSnippetContent } from './note-content.model' ; const _noteId = new StringIdDummy ( 'NoteId' ) ; export class NoteSnippetContentDummy extends Dummy < NoteSnippetContent > { private type = new TypesDummy < NoteSnippetTypes > ( [ NoteSnippetTypes . TEXT , NoteSnippetTypes . CODE , ] ) ; private value = new TextDummy ( 'SnippetValue' ) ; private codeLanguageId = new TextDummy ( 'CodeLanguage' ) ; private codeFileName = new TextDummy ( 'CodeFileName' ) ; create ( type = this . type . create ( ) ) { const dummy = { type , value : this . value . create ( ) , } ; if ( type === NoteSnippetTypes . CODE ) { return { ... dummy , codeLanguageId : this . codeLanguageId . create ( ) , codeFileName : this . codeFileName . create ( ) , } ; } else { return dummy ; } } } export class NoteContentDummy extends Dummy < NoteContent > { private snippet = new NoteSnippetContentDummy ( ) ; create ( snippetCount = 5 ) { return { noteId : _noteId . create ( ) , snippets : createDummies ( this . snippet , snippetCount ) , } ; } createFromNote ( note ) { return { noteId : note . id , snippets : [ ] , } ; } }