Skip to content

Commit

Permalink
Merge pull request #12234 from bbc/Byline-only-author-required
Browse files Browse the repository at this point in the history
WSTEAM1: Byline: author is only required field
  • Loading branch information
Isabella-Mitchell authored Dec 11, 2024
2 parents 8346472 + 16b4c11 commit a3ad68b
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 259 deletions.
7 changes: 0 additions & 7 deletions src/app/components/Byline/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { render, screen } from '../react-testing-library-with-providers';
import Byline from '.';
import ArticleTimestamp from '../../legacy/containers/ArticleTimestamp';
import {
bylineWithNoRole,
bylineWithNoAuthor,
bylineWithNameAndRole,
bylineWithLink,
Expand All @@ -24,12 +23,6 @@ describe('Byline', () => {
expect(role).toBeInTheDocument();
});

it('Should return null when there is no role in the data', () => {
const { container } = render(<Byline blocks={bylineWithNoRole} />);

expect(container).toBeEmptyDOMElement();
});

it('Should return null when there is no author in the data', () => {
const { container } = render(<Byline blocks={bylineWithNoAuthor} />);

Expand Down
14 changes: 0 additions & 14 deletions src/app/components/Byline/utilities/bylineExtractor/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import bylineExtractor from '.';
import {
bylineWithNoRole,
bylineWithNoAuthor,
bylineWithNoAuthorAndRole,
bylineWithLink,
bylineWithNonPngPhoto,
bylineWithAllData,
Expand All @@ -15,18 +13,6 @@ describe('bylineExtractor', () => {
expect(bylineValues).toBeNull();
});

it('should return null when jobRole is not present', () => {
const bylineValues = bylineExtractor(bylineWithNoRole);

expect(bylineValues).toBeNull();
});

it('should return null when jobRole and authorName are not present', () => {
const bylineValues = bylineExtractor(bylineWithNoAuthorAndRole);

expect(bylineValues).toBeNull();
});

it('should return an object containing all byline data', () => {
const bylineValues = bylineExtractor(bylineWithAllData);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const bylineExtractor = (blocks: OptimoBylineContributorBlock[]) => {
const authorName = pathOrZeroIndexModelBlocks(2, 'text', authorBlock);
const jobRole = pathOrZeroIndexModelBlocks(2, 'text', jobRoleBlock);

if (!authorName || !jobRole) {
if (!authorName) {
return null;
}

Expand Down
237 changes: 0 additions & 237 deletions src/app/pages/ArticlePage/fixtureData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -841,139 +841,6 @@ export const articleStyDataPidgin = articleDataBuilder(
'STY',
) as unknown as Article;

export const bylineWithNoRole = [
{
type: 'contributor',
model: {
topicId: '',
topicUrl: '/news/topics/c8qx38nq177t',
blocks: [
{
type: 'name',
model: {
blocks: [
{
type: 'text',
model: {
blocks: [
{
type: 'paragraph',
model: {
text: 'Single Byline (all values)',
blocks: [
{
type: 'fragment',
model: {
text: 'Single Byline (all values)',
attributes: [],
},
},
],
},
},
],
},
},
],
},
},
{
type: 'link',
model: {
blocks: [
{
type: 'text',
model: {
blocks: [
{
type: 'paragraph',
model: {
text: 'test',
blocks: [
{
type: 'urlLink',
model: {
text: 'test',
locator: 'https://twitter.com/test',
blocks: [
{
type: 'fragment',
model: {
text: 'test',
attributes: [],
},
},
],
isExternal: true,
},
},
],
},
},
],
},
},
],
},
},
{
type: 'location',
model: {
blocks: [
{
type: 'text',
model: {
blocks: [
{
type: 'paragraph',
model: {
text: 'London',
blocks: [
{
type: 'fragment',
model: {
text: 'London',
attributes: [],
},
},
],
},
},
],
},
},
],
},
},
{
type: 'images',
model: {
blocks: [
{
type: 'image',
model: {
blocks: [
{
type: 'rawImage',
model: {
width: 640,
height: 562,
locator:
'f974/live/36226e20-94aa-11ec-9acc-37a09ce5ea88.png',
originCode: 'cpsprodpb',
},
},
],
},
},
],
},
},
],
},
},
] as OptimoBylineContributorBlock[];

export const bylineWithNoAuthor = [
{
type: 'contributor',
Expand Down Expand Up @@ -1107,110 +974,6 @@ export const bylineWithNoAuthor = [
},
] as OptimoBylineContributorBlock[];

export const bylineWithNoAuthorAndRole = [
{
type: 'contributor',
model: {
topicId: '',
topicUrl: '',
blocks: [
{
type: 'link',
model: {
blocks: [
{
type: 'text',
model: {
blocks: [
{
type: 'paragraph',
model: {
text: 'test',
blocks: [
{
type: 'urlLink',
model: {
text: 'test',
locator: 'https://twitter.com/test',
blocks: [
{
type: 'fragment',
model: {
text: 'test',
attributes: [],
},
},
],
isExternal: true,
},
},
],
},
},
],
},
},
],
},
},
{
type: 'location',
model: {
blocks: [
{
type: 'text',
model: {
blocks: [
{
type: 'paragraph',
model: {
text: 'London',
blocks: [
{
type: 'fragment',
model: {
text: 'London',
attributes: [],
},
},
],
},
},
],
},
},
],
},
},
{
type: 'images',
model: {
blocks: [
{
type: 'image',
model: {
blocks: [
{
type: 'rawImage',
model: {
width: 640,
height: 562,
locator:
'f974/live/36226e20-94aa-11ec-9acc-37a09ce5ea88.png',
originCode: 'cpsprodpb',
},
},
],
},
},
],
},
},
],
},
},
] as OptimoBylineContributorBlock[];

export const bylineWithNameAndRole = [
{
type: 'contributor',
Expand Down

0 comments on commit a3ad68b

Please sign in to comment.