diff --git a/README.md b/README.md index 431ba6d..7901bd2 100644 --- a/README.md +++ b/README.md @@ -4,16 +4,16 @@ Powerful platforms like [Elasticsearch](https://www.elastic.co/) & [Next.js](https://nextjs.org/) make it possible for museums to easily build performant, responsive and accessible faceted searches for their online collections. -Based on [shadcn/next-template](https://github.com/shadcn/next-template), which is an implementation of [Radix UI](https://www.radix-ui.com/) with [Tailwind CSS](https://tailwindcss.com/). +Based on [shadcn/next-template](https://github.com/shadcn-ui/next-template), which is an implementation of [Radix UI](https://www.radix-ui.com/) with [Tailwind CSS](https://tailwindcss.com/). This project has been deployed on Vercel at [https://musefully.org](https://musefully.org) ## Documentation: -* [Setup Guide](./docs/SETUP.md) -* [Architecture](./docs/ARCHITECTURE.md) -* [Datasets, Vocabularies & Schema](./docs/SCHEMA.md) -* [API](./docs/API.md) +- [Setup Guide](./docs/SETUP.md) +- [Architecture](./docs/ARCHITECTURE.md) +- [Datasets, Vocabularies & Schema](./docs/SCHEMA.md) +- [API](./docs/API.md) ## Features diff --git a/__tests__/lib/import/ingesters/met/collectionsIngester.test.ts b/__tests__/lib/import/ingesters/met/collectionsIngester.test.ts index 6b0c4d9..b8c6987 100644 --- a/__tests__/lib/import/ingesters/met/collectionsIngester.test.ts +++ b/__tests__/lib/import/ingesters/met/collectionsIngester.test.ts @@ -1,5 +1,5 @@ -import { ingester } from '@/lib/import/ingesters/met/collectionsIngester'; import { ArtworkDocument } from '@/types/document'; +import { ingester } from '@/lib/import/ingesters/met/collectionsIngester'; const mockMetDocument = { 'Object Number': '04.1a–c', @@ -66,7 +66,9 @@ const mockMetDocument = { describe('transformDoc', () => { it('should transform MetDocument into ArtworkDocument', async () => { - const esDoc = await ingester.transform(mockMetDocument) as ArtworkDocument; + const esDoc = (await ingester.transform( + mockMetDocument + )) as ArtworkDocument; expect(esDoc.source).toBe('The Met'); expect(esDoc.id).toBe('35'); diff --git a/__tests__/lib/openai/openaiArtworkDescription.test.ts b/__tests__/lib/openai/openaiArtworkDescription.test.ts new file mode 100644 index 0000000..51a34de --- /dev/null +++ b/__tests__/lib/openai/openaiArtworkDescription.test.ts @@ -0,0 +1,32 @@ +import { parseAltTextAndLongDescription } from '@/lib/openai/openaiArtworkDescription'; + +describe('parseAltTextAndLongDescription', () => { + it('should correctly parse valid input', () => { + const input = `Alt Text: Sample ALT text.\n\nLong Description: Sample LONG description.`; + const result = parseAltTextAndLongDescription(input); + expect(result).toEqual({ + altText: 'Sample ALT text.', + longDescription: 'Sample LONG description.', + }); + }); + + it('should handle input with different casing', () => { + const input = `alt text: Sample ALT text.\n\nlong description: Sample LONG description.`; + const result = parseAltTextAndLongDescription(input); + expect(result).toEqual({ + altText: 'Sample ALT text.', + longDescription: 'Sample LONG description.', + }); + }); + + it('should return undefined for invalid input types', () => { + const result = parseAltTextAndLongDescription(''); + expect(result).toBeUndefined(); + }); + + it('should return undefined if input does not match the expected format', () => { + const input = `This is not a valid format.`; + const result = parseAltTextAndLongDescription(input); + expect(result).toBeUndefined(); + }); +}); diff --git a/app/page.tsx b/app/page.tsx index 22c5521..bfa6056 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -21,13 +21,14 @@ import { ImageNewsCard } from '@/components/search-card/image-news-card'; import { NewsCard } from '@/components/search-card/news-card'; import { ArtSearchCheckboxes } from '@/components/search/art-search-checkboxes'; import { ArtistTermCard } from '@/components/search/artist-term-card'; +import { EventSearchCheckboxes } from '@/components/search/event-search-checkboxes'; import { SearchAsYouTypeInput } from '@/components/search/search-as-you-type-input'; import { SearchDidYouMean } from '@/components/search/search-did-you-mean'; import { SearchFilterTags } from '@/components/search/search-filter-tags'; import { SearchFilters } from '@/components/search/search-filters'; import { SearchPagination } from '@/components/search/search-pagination'; import { Timeline } from '@/components/timeline/timeline'; -import { EventSearchCheckboxes } from '@/components/search/event-search-checkboxes'; + function getLayoutGridClass(layout: LayoutType) { if (layout === LAYOUT_GRID) return 'my-4 relative grid grid-cols-1 gap-8 pb-8 md:grid-cols-2 md:pb-10 lg:grid-cols-3'; @@ -106,9 +107,7 @@ export default async function Page({ params, searchParams }: Props) { - {sanitizedParams.isShowTimeline && ( - - )} + {sanitizedParams.isShowTimeline && }
{items?.length > 0 && diff --git a/components/image/image-zoom.tsx b/components/image/image-zoom.tsx index a1b73d9..85075a7 100644 --- a/components/image/image-zoom.tsx +++ b/components/image/image-zoom.tsx @@ -76,7 +76,7 @@ export function ImageZoom({ item }: ImageZoomProps) { aria-label={dict['button.download']} >