import type { BaseField, Collection, CollectionFile, CollectionFileWithDefaults, CollectionWithDefaults, Field, FilesCollection, FilesCollectionWithDefaults, FolderCollection, FolderCollectionWithDefaults, } from '@staticcms/core'; export const createMockFolderCollection = ( extra: Partial> = {}, ...fields: Field[] ): FolderCollection => ({ name: 'mock_collection', label: 'Mock Collections', label_singular: 'Mock Collection', description: 'The description is a great place for tone setting, high level information, and editing guidelines that are specific to a collection.\n', folder: 'mock_collection', summary: '{{title}}', sortable_fields: { fields: ['title'], default: { field: 'title', }, }, create: true, fields: [ { label: 'Title', name: 'title', widget: 'string', }, ...fields, ], ...extra, }); export const createMockFolderCollectionWithDefaults = ( extra: Partial> = {}, ...fields: Field[] ): FolderCollectionWithDefaults => ({ ...createMockFolderCollection(extra, ...fields), i18n: extra.i18n, }); export const createMockCollectionFile = ( extra: Partial> = {}, ...fields: Field[] ): CollectionFile => ({ name: 'mock_collection', label: 'Mock Collections', label_singular: 'Mock Collection', file: 'mock_collection.md', description: 'The description is a great place for tone setting, high level information, and editing guidelines that are specific to a collection.\n', fields: [ { label: 'Title', name: 'title', widget: 'string', }, ...fields, ], ...extra, }); export const createMockCollectionFileWithDefaults = ( extra: Partial> = {}, ...fields: Field[] ): CollectionFileWithDefaults => ({ ...createMockCollectionFile(extra, ...fields), i18n: extra.i18n, }); export const createMockFilesCollection = ( extra: Omit>, 'files'> & Pick, 'files'>, ): FilesCollection => ({ name: 'mock_collection', label: 'Mock Collections', label_singular: 'Mock Collection', description: 'The description is a great place for tone setting, high level information, and editing guidelines that are specific to a collection.\n', summary: '{{title}}', sortable_fields: { fields: ['title'], default: { field: 'title', }, }, ...extra, }); export const createMockFilesCollectionWithDefaults = ( extra: Omit>, 'files'> & Pick, 'files'>, ): FilesCollectionWithDefaults => ({ ...createMockFilesCollection(extra), i18n: extra.i18n, files: extra.files, });