Skip to content
Draft
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@guardian/core-web-vitals": "6.0.0",
"@guardian/identity-auth": "6.0.1",
"@guardian/identity-auth-frontend": "8.1.0",
"@guardian/libs": "30.1.1",
"@guardian/libs": "0.0.0-canary-20260324113710",
"@guardian/prettier": "^8.0.1",
"@guardian/shimport": "^1.0.2",
"@guardian/source-foundations": "16.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@ import type {
AdsConfigTCFV2,
AdsConfigUSNATorAus,
} from '@guardian/commercial-core/dist/cjs/types';
import type { ConsentState, OnConsentChangeCallback } from '@guardian/libs';
import type { AUSConsentState, ConsentState, OnConsentChangeCallback } from '@guardian/libs';
import { _ as youtubePlayer } from 'common/modules/atoms/youtube-player';

const ausConsent: AUSConsentState = {
personalisedAdvertising: true,
signalStatus: 'ready',
};

jest.mock('common/modules/commercial/build-page-targeting', () => ({
getPageTargeting: jest.fn(() => ({ key: 'value' })),
}));
Expand Down Expand Up @@ -90,6 +95,7 @@ const canTargetUSNAT = (canTarget: boolean): ConsentState => ({
const canTargetAUS = (canTarget: boolean): ConsentState => ({
aus: {
personalisedAdvertising: canTarget,
signalStatus: 'ready',
},
canTarget,
framework: 'aus',
Expand Down Expand Up @@ -200,7 +206,7 @@ describe('Get Host (no-cookie)', () => {
test('`youtube-nocookie.com` with an ad-free', () => {
const host = youtubePlayer.getHost({
consentState: {
aus: { personalisedAdvertising: true },
aus: ausConsent,
canTarget: true,
framework: 'aus',
},
Expand All @@ -214,7 +220,7 @@ describe('Get Host (no-cookie)', () => {
test('`youtube-nocookie.com` with for other than youtube-media-atom__iframe', () => {
const host = youtubePlayer.getHost({
consentState: {
aus: { personalisedAdvertising: true },
aus: ausConsent,
canTarget: true,
framework: 'aus',
},
Expand All @@ -228,7 +234,7 @@ describe('Get Host (no-cookie)', () => {
test('`youtube.com` when all three conditions met', () => {
const host = youtubePlayer.getHost({
consentState: {
aus: { personalisedAdvertising: true },
aus: ausConsent,
canTarget: true,
framework: 'aus',
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import type { ConsentState, OnConsentChangeCallback } from '@guardian/libs';
import type { AUSConsentState, ConsentState, OnConsentChangeCallback } from '@guardian/libs';
import { hasRequiredConsents } from './hasRequiredConsents';

const brazeVendorId = '5ed8c49c4b8ce4571c7ad801';

let mockOnConsentChangeResult: ConsentState | undefined;

const ausConsent: AUSConsentState = {
personalisedAdvertising: true,
signalStatus: 'ready',
};

const ausNonConsent: AUSConsentState = {
personalisedAdvertising: false,
signalStatus: 'ready',
};
jest.mock(
'@guardian/libs',
() =>
Expand Down Expand Up @@ -96,9 +106,7 @@ describe('hasRequiredConsents', () => {
describe('when the user is covered by aus and consent is given', () => {
it('returns a promise which resolves with true', async () => {
mockOnConsentChangeResult = {
aus: {
personalisedAdvertising: true,
},
aus: ausConsent,
canTarget: true,
framework: 'aus',
};
Expand All @@ -110,9 +118,7 @@ describe('hasRequiredConsents', () => {
describe('when the user is covered by aus and consent is not given', () => {
it('returns a promise which resolves with false', async () => {
mockOnConsentChangeResult = {
aus: {
personalisedAdvertising: false,
},
aus: ausNonConsent,
canTarget: false,
framework: 'aus',
};
Expand Down
Loading
Loading