diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-11-29 12:28:03 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-11-29 13:47:07 +0100 |
| commit | dfa894b76ee3584bf169710c78c57330c5d6ee67 (patch) | |
| tree | 41380a93e2838452236a720f27f85fb14502f56a /src/services/graphql/helpers/convert-taxonomy-to-page-link.test.ts | |
| parent | 29a1dec4de0aa7ba64ef068a83b1b8589fbc3ad0 (diff) | |
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
Diffstat (limited to 'src/services/graphql/helpers/convert-taxonomy-to-page-link.test.ts')
| -rw-r--r-- | src/services/graphql/helpers/convert-taxonomy-to-page-link.test.ts | 14 |
1 files changed, 9 insertions, 5 deletions
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}`); }); }); |
