Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dotcom-rendering/src/frontend/feFront.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ export type FESupportingContent = {
properties: {
href?: string;
webUrl?: string;
tests?: EditorialTest[];
};
header: {
kicker?: {
Expand Down
153 changes: 153 additions & 0 deletions dotcom-rendering/src/frontend/schemas/feFront.json
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,57 @@
},
"webUrl": {
"type": "string"
},
"tests": {
"type": "array",
"items": {
"type": "object",
"properties": {
"testUuid": {
"type": "string"
},
"variantMeta": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"$ref": "#/definitions/VariantId"
},
"meta": {
"type": "object",
"additionalProperties": {}
}
},
"required": [
"id",
"meta"
]
}
},
"startDate": {
"type": "number"
},
"expiryDate": {
"type": "number"
},
"frontsThisTestCanRunOn": {
"type": "array",
"items": {
"type": "string"
}
},
"hasManuallyEndedOnThisTrail": {
"type": "boolean"
}
},
"required": [
"frontsThisTestCanRunOn",
"hasManuallyEndedOnThisTrail",
"testUuid",
"variantMeta"
]
}
}
}
},
Expand Down Expand Up @@ -1836,6 +1887,57 @@
},
"webUrl": {
"type": "string"
},
"tests": {
"type": "array",
"items": {
"type": "object",
"properties": {
"testUuid": {
"type": "string"
},
"variantMeta": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"$ref": "#/definitions/VariantId"
},
"meta": {
"type": "object",
"additionalProperties": {}
}
},
"required": [
"id",
"meta"
]
}
},
"startDate": {
"type": "number"
},
"expiryDate": {
"type": "number"
},
"frontsThisTestCanRunOn": {
"type": "array",
"items": {
"type": "string"
}
},
"hasManuallyEndedOnThisTrail": {
"type": "boolean"
}
},
"required": [
"frontsThisTestCanRunOn",
"hasManuallyEndedOnThisTrail",
"testUuid",
"variantMeta"
]
}
}
}
},
Expand Down Expand Up @@ -2722,6 +2824,57 @@
},
"webUrl": {
"type": "string"
},
"tests": {
"type": "array",
"items": {
"type": "object",
"properties": {
"testUuid": {
"type": "string"
},
"variantMeta": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"$ref": "#/definitions/VariantId"
},
"meta": {
"type": "object",
"additionalProperties": {}
}
},
"required": [
"id",
"meta"
]
}
},
"startDate": {
"type": "number"
},
"expiryDate": {
"type": "number"
},
"frontsThisTestCanRunOn": {
"type": "array",
"items": {
"type": "string"
}
},
"hasManuallyEndedOnThisTrail": {
"type": "boolean"
}
},
"required": [
"frontsThisTestCanRunOn",
"hasManuallyEndedOnThisTrail",
"testUuid",
"variantMeta"
]
}
}
}
},
Expand Down
51 changes: 51 additions & 0 deletions dotcom-rendering/src/frontend/schemas/feTagPage.json
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,57 @@
},
"webUrl": {
"type": "string"
},
"tests": {
"type": "array",
"items": {
"type": "object",
"properties": {
"testUuid": {
"type": "string"
},
"variantMeta": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"$ref": "#/definitions/VariantId"
},
"meta": {
"type": "object",
"additionalProperties": {}
}
},
"required": [
"id",
"meta"
]
}
},
"startDate": {
"type": "number"
},
"expiryDate": {
"type": "number"
},
"frontsThisTestCanRunOn": {
"type": "array",
"items": {
"type": "string"
}
},
"hasManuallyEndedOnThisTrail": {
"type": "boolean"
}
},
"required": [
"frontsThisTestCanRunOn",
"hasManuallyEndedOnThisTrail",
"testUuid",
"variantMeta"
]
}
}
}
},
Expand Down
39 changes: 39 additions & 0 deletions dotcom-rendering/src/model/enhanceCards.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type {
FEFrontCardStyle,
FEMediaAsset,
FEMediaAtom,
FESupportingContent,
} from '../frontend/feFront';
import { ArticleDesign, ArticleDisplay, Pillar } from '../lib/articleFormat';
import type { EditorialTest, VariantMeta } from '../types/front';
Expand Down Expand Up @@ -656,6 +657,16 @@ describe('Enhance Cards', () => {
},
};

const cardWithSublinkWithEditorialTest = {
...cardWithNoEditorialTest,
supportingContent: [cardWithEditorialTest],
};

const cardWithSublinkWithExpiredEditorialTest = {
...cardWithNoEditorialTest,
supportingContent: [cardWithExpiredEditorialTest],
};

it('returns the default headline if no editorial test exists on the card, page is not in allowed fronts list, and user is not in a test bucket', () => {
expect(
decideHeadline(
Expand Down Expand Up @@ -789,5 +800,33 @@ describe('Enhance Cards', () => {
),
).toEqual('Headline');
});

it('returns the variant headline if an editorial test is present on a sublink', () => {
expect(
decideHeadline(
cardWithSublinkWithEditorialTest
.supportingContent[0] as FESupportingContent,
{
'fronts-and-curation-editorial-test': 'a',
},
true,
'test-front',
),
).toEqual('Headline A');
});

it('returns the default headline for a sublink if an editorial test is expired on a sublink', () => {
expect(
decideHeadline(
cardWithSublinkWithExpiredEditorialTest
.supportingContent[0] as FESupportingContent,
{
'fronts-and-curation-editorial-test': 'a',
},
true,
'test-front',
),
).toEqual('Headline');
});
});
});
Loading
Loading