From 226bc4e2803cc66050b87eeee5a81d8b8c69f82a Mon Sep 17 00:00:00 2001 From: Charlotte Date: Thu, 16 Jan 2025 10:37:36 +0000 Subject: [PATCH] update types used in tests --- .../src/lib/getFrontsAdPositions.test.ts | 87 +++++++------------ 1 file changed, 30 insertions(+), 57 deletions(-) diff --git a/dotcom-rendering/src/lib/getFrontsAdPositions.test.ts b/dotcom-rendering/src/lib/getFrontsAdPositions.test.ts index 77d95906a6..df1b4728c6 100644 --- a/dotcom-rendering/src/lib/getFrontsAdPositions.test.ts +++ b/dotcom-rendering/src/lib/getFrontsAdPositions.test.ts @@ -3,7 +3,6 @@ import { testCollectionsUk, testCollectionsUs, } from '../../fixtures/manual/frontCollections'; -import type { DCRCollectionType } from '../types/front'; import { type AdCandidate, getFrontsBannerAdPositions, @@ -59,7 +58,7 @@ describe('Mobile Ads', () => { // We used https://www.theguardian.com/uk/commentisfree as a blueprint it('Non-network front, with more than 4 collections, without thrashers', () => { - const testCollections: Pick[] = [ + const testCollections: AdCandidate[] = [ { collectionType: 'fixed/large/slow-XIV' }, { collectionType: 'fixed/medium/slow-VI' }, { collectionType: 'fixed/small/slow-IV' }, @@ -82,7 +81,7 @@ describe('Mobile Ads', () => { // We used https://www.theguardian.com/uk as a blueprint it('UK Network Front, with more than 4 collections, with thrashers at various places', () => { - const testCollections: Pick[] = [ + const testCollections: AdCandidate[] = [ { collectionType: 'dynamic/fast' }, { collectionType: 'fixed/small/slow-IV' }, { collectionType: 'dynamic/slow' }, @@ -116,7 +115,7 @@ describe('Mobile Ads', () => { // We used https://www.theguardian.com/international as a blueprint it('International Network Front, with more than 4 collections, with thrashers at various places', () => { - const testCollections: Pick[] = [ + const testCollections: AdCandidate[] = [ { collectionType: 'dynamic/fast' }, { collectionType: 'fixed/small/slow-IV' }, { collectionType: 'dynamic/slow' }, @@ -146,7 +145,7 @@ describe('Mobile Ads', () => { // We used https://www.theguardian.com/us as a blueprint it('US Network Front, with more than 4 collections, with thrashers at various places', () => { - const testCollections: Pick[] = [ + const testCollections: AdCandidate[] = [ { collectionType: 'dynamic/fast' }, { collectionType: 'fixed/small/slow-IV' }, { collectionType: 'fixed/small/slow-IV' }, @@ -177,7 +176,7 @@ describe('Mobile Ads', () => { // We used https://www.theguardian.com/uk/lifeandstyle as a blueprint it('Lifeandstyle front, with more than 4 collections, with thrashers at various places', () => { - const testCollections: Pick[] = [ + const testCollections: AdCandidate[] = [ { collectionType: 'dynamic/slow' }, { collectionType: 'fixed/medium/slow-VI' }, { collectionType: 'fixed/thrasher' }, @@ -203,7 +202,7 @@ describe('Mobile Ads', () => { // We used https://www.theguardian.com/tone/recipes as a blueprint it('Recipes front, with more than 4 collections, with thrasher at the first position', () => { - const testCollections: Pick[] = [ + const testCollections: AdCandidate[] = [ { collectionType: 'fixed/thrasher' }, { collectionType: 'fixed/medium/slow-VI' }, { collectionType: 'fixed/small/slow-V-third' }, @@ -227,78 +226,52 @@ describe('Mobile Ads', () => { it('Europe Network Front, with beta containers and more than 4 collections, with thrashers in various places', () => { const testCollections: AdCandidate[] = [ - { collectionType: 'flexible/general', containerLevel: 'Primary' }, // Ad position 0 - { collectionType: 'scrollable/small', containerLevel: 'Secondary' }, - { collectionType: 'scrollable/small', containerLevel: 'Secondary' }, + { collectionType: 'flexible/general', containerLevel: 'Primary' }, // Ad position (0) + { collectionType: 'scrollable/small', containerLevel: 'Secondary' }, // Ignored - is before secondary container + { collectionType: 'scrollable/small', containerLevel: 'Secondary' }, // Ignored - is before secondary container { collectionType: 'scrollable/medium', containerLevel: 'Secondary', - }, + }, // Ignored - is before secondary container { collectionType: 'scrollable/feature', containerLevel: 'Secondary', - }, // Ad position 4 - { collectionType: 'static/feature/2', containerLevel: 'Primary' }, - { - collectionType: 'scrollable/medium', - containerLevel: 'Secondary', - }, // Ad position 6 - { collectionType: 'flexible/special', containerLevel: 'Primary' }, - { collectionType: 'fixed/thrasher' }, // Ad position 8 - { collectionType: 'flexible/general', containerLevel: 'Primary' }, - { collectionType: 'scrollable/small', containerLevel: 'Secondary' }, // Ad position 10 - { collectionType: 'static/feature/2', containerLevel: 'Primary' }, - { collectionType: 'scrollable/small', containerLevel: 'Secondary' }, - { collectionType: 'scrollable/small', containerLevel: 'Secondary' }, - { collectionType: 'scrollable/small', containerLevel: 'Secondary' }, // Ad position 14 - { collectionType: 'static/feature/2', containerLevel: 'Primary' }, - { - collectionType: 'scrollable/medium', - containerLevel: 'Secondary', - }, - { - collectionType: 'scrollable/medium', - containerLevel: 'Secondary', - }, - { collectionType: 'scrollable/small', containerLevel: 'Secondary' }, - { collectionType: 'fixed/thrasher' }, // Ad position 19 - { collectionType: 'static/feature/2', containerLevel: 'Primary' }, + }, // Ad position (4) + { collectionType: 'static/feature/2', containerLevel: 'Primary' }, // Ignored - is before secondary container { collectionType: 'scrollable/medium', containerLevel: 'Secondary', - }, - { collectionType: 'scrollable/small', containerLevel: 'Secondary' }, - { collectionType: 'scrollable/small', containerLevel: 'Secondary' }, + }, // Ad position (6) + { collectionType: 'flexible/special', containerLevel: 'Primary' }, // Ignored - is before thrasher + { collectionType: 'fixed/thrasher' }, // Ad position (8) + { collectionType: 'flexible/general', containerLevel: 'Primary' }, // Ignored - is before secondary container + { collectionType: 'scrollable/small', containerLevel: 'Secondary' }, // Ad position (10) + { collectionType: 'static/feature/2', containerLevel: 'Primary' }, // Ignored - is before secondary container + { collectionType: 'scrollable/small', containerLevel: 'Secondary' }, // Ignored - is before secondary container + { collectionType: 'scrollable/small', containerLevel: 'Secondary' }, // Ignored - is before secondary container + { collectionType: 'scrollable/small', containerLevel: 'Secondary' }, // Ad position (14) + { collectionType: 'static/feature/2', containerLevel: 'Primary' }, // Ignored - is before secondary container { collectionType: 'scrollable/medium', containerLevel: 'Secondary', - }, + }, // Ignored - is before secondary container { collectionType: 'scrollable/medium', containerLevel: 'Secondary', - }, - { collectionType: 'scrollable/small', containerLevel: 'Secondary' }, - { - collectionType: 'scrollable/medium', - containerLevel: 'Secondary', - }, // Ad position 27 - { collectionType: 'flexible/general', containerLevel: 'Primary' }, - { - collectionType: 'scrollable/medium', - containerLevel: 'Secondary', - }, - { collectionType: 'scrollable/small', containerLevel: 'Secondary' }, // Ad position 30 - { collectionType: 'flexible/general', containerLevel: 'Primary' }, + }, // Ignored - is before secondary container + { collectionType: 'scrollable/small', containerLevel: 'Secondary' }, // Ignored - is before thrasher + { collectionType: 'fixed/thrasher' }, // Ad position (19) + { collectionType: 'flexible/general', containerLevel: 'Primary' }, // Ignored - is before secondary container { collectionType: 'scrollable/feature', containerLevel: 'Secondary', - }, - { collectionType: 'news/most-popular' }, + }, // Ad position (21) + { collectionType: 'news/most-popular' }, // Ignored - is most viewed container ]; const mobileAdPositions = getMobileAdPositions(testCollections); - expect(mobileAdPositions).toEqual([0, 4, 6, 8, 10, 14, 19, 27, 30, 32]); + expect(mobileAdPositions).toEqual([0, 4, 6, 8, 10, 14, 19, 21]); }); });