Skip to content

Commit

Permalink
WSTEAM1-1612 - noindex meta tag for av-embeds pages (#12331)
Browse files Browse the repository at this point in the history
  • Loading branch information
amoore108 authored Jan 24, 2025
1 parent 8e7a137 commit 5689f0c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
20 changes: 16 additions & 4 deletions ws-nextjs-app/pages/[service]/av-embeds/AvEmbedsMetadata.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import React from 'react';
import {
render,
waitFor,
} from '../../../../src/app/components/react-testing-library-with-providers';
import serbianCyrCps from '../../../../data/serbian/av-embeds/cyr/srbija-68707945.json';
} from '#app/components/react-testing-library-with-providers';
import serbianCyrCps from '#data/serbian/av-embeds/cyr/srbija-68707945.json';
import { AV_EMBEDS } from '#app/routes/utils/pageTypes';
import { MediaBlock } from '#app/components/MediaLoader/types';
import AvEmbedsMetadata from './AvEmbedsMetadata';
import { AV_EMBEDS } from '../../../../src/app/routes/utils/pageTypes';
import { MediaBlock } from '../../../../src/app/components/MediaLoader/types';

const avEmbedsMetadataProps = {
pageData: {
Expand All @@ -30,6 +30,18 @@ const avEmbedsMetadataProps = {
};

describe('AV Embeds Page', () => {
it('should render the noindex meta tag', async () => {
render(<AvEmbedsMetadata {...avEmbedsMetadataProps} />);

await waitFor(() => {
const actual = document
.querySelector('head > meta[name="robots"]')
?.getAttribute('content');

expect(actual).toEqual('noindex');
});
});

it('should render the viewport meta tag', async () => {
render(<AvEmbedsMetadata {...avEmbedsMetadataProps} />);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const AvEmbedsMetadata = ({ pageData }: AvEmbedsPageProps) => {

return (
<Helmet>
<meta name="robots" content="noindex" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, user-scalable=1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ describe('AV Embeds Page', () => {
const helmetMetaTags = Helmet.peek()?.metaTags;

expect(helmetMetaTags).toEqual([
{ name: 'robots', content: 'noindex' },
{
name: 'viewport',
content: 'width=device-width, initial-scale=1, user-scalable=1',
Expand Down

0 comments on commit 5689f0c

Please sign in to comment.