From dfa894b76ee3584bf169710c78c57330c5d6ee67 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Wed, 29 Nov 2023 12:28:03 +0100 Subject: fix(pages,services): make thematics & topics pages usable again When I refactored the fetchers and convertors in #f111685 I forgot to convert WPThematicPreview and WPTopicPreview so the thematics and topics pages was broken. I also: * removed the ToC added by error in #70b4f63 * fix heading styles * fix website url in topics pages --- .../graphql/helpers/convert-taxonomy-to-page-link.test.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/services/graphql/helpers/convert-taxonomy-to-page-link.test.ts') diff --git a/src/services/graphql/helpers/convert-taxonomy-to-page-link.test.ts b/src/services/graphql/helpers/convert-taxonomy-to-page-link.test.ts index b687ccb..54a62ad 100644 --- a/src/services/graphql/helpers/convert-taxonomy-to-page-link.test.ts +++ b/src/services/graphql/helpers/convert-taxonomy-to-page-link.test.ts @@ -1,6 +1,10 @@ import { describe, expect, it } from '@jest/globals'; import type { WPThematicPreview, WPTopicPreview } from '../../../types'; -import { convertTaxonomyToPageLink } from './convert-taxonomy-to-page-link'; +import { ROUTES } from '../../../utils/constants'; +import { + convertWPThematicPreviewToPageLink, + convertWPTopicPreviewToPageLink, +} from './convert-taxonomy-to-page-link'; describe('convert-taxonomy-to-page-link', () => { it('can convert a WPThematicPreview object to a Thematic object', () => { @@ -9,12 +13,12 @@ describe('convert-taxonomy-to-page-link', () => { slug: '/the-thematic-slug', title: 'et ut alias', }; - const result = convertTaxonomyToPageLink(thematic); + const result = convertWPThematicPreviewToPageLink(thematic); expect(result.id).toBe(thematic.databaseId); expect(result.logo).toBeUndefined(); expect(result.name).toBe(thematic.title); - expect(result.url).toBe(thematic.slug); + expect(result.url).toBe(`${ROUTES.THEMATICS.INDEX}/${thematic.slug}`); }); it('can convert a WPTopicPreview object to a Topic object', () => { @@ -34,7 +38,7 @@ describe('convert-taxonomy-to-page-link', () => { slug: '/the-topic-slug', title: 'et ut alias', }; - const result = convertTaxonomyToPageLink(topic); + const result = convertWPTopicPreviewToPageLink(topic); expect(result.id).toBe(topic.databaseId); expect(result.logo?.alt).toBe(topic.featuredImage?.node.altText); @@ -47,6 +51,6 @@ describe('convert-taxonomy-to-page-link', () => { topic.featuredImage?.node.mediaDetails.width ); expect(result.name).toBe(topic.title); - expect(result.url).toBe(topic.slug); + expect(result.url).toBe(`${ROUTES.TOPICS}/${topic.slug}`); }); }); -- cgit v1.2.3