diff --git a/libs/@guardian/libs/src/consent-management-platform/usnat/getConsentState.test.js b/libs/@guardian/libs/src/consent-management-platform/usnat/getConsentState.test.js index 7fb914083..a3bca6514 100644 --- a/libs/@guardian/libs/src/consent-management-platform/usnat/getConsentState.test.js +++ b/libs/@guardian/libs/src/consent-management-platform/usnat/getConsentState.test.js @@ -7,6 +7,9 @@ import { getConsentState } from './getConsentState.ts'; jest.mock('./api'); describe('getConsentState', () => { + beforeEach(() => { + jest.clearAllMocks(); + }); it('gets the gpp consent state correctly - doNotSell is false', async () => { getGPPData.mockResolvedValue(gppDataCanSell); diff --git a/libs/@guardian/libs/src/consent-management-platform/usnat/getConsentState.ts b/libs/@guardian/libs/src/consent-management-platform/usnat/getConsentState.ts index 96b63eee4..899b72396 100644 --- a/libs/@guardian/libs/src/consent-management-platform/usnat/getConsentState.ts +++ b/libs/@guardian/libs/src/consent-management-platform/usnat/getConsentState.ts @@ -4,7 +4,7 @@ import { getGPPData } from './api'; export const getConsentState: () => Promise = async () => { let doNotSell = false; // Opt-Out const gppData = await getGPPData(); - const supportedAPI = gppData.parsedSections[0]; + const supportedAPI = Object.values(gppData.parsedSections)[0]; if (supportedAPI) { // https://github.com/InteractiveAdvertisingBureau/Global-Privacy-Platform/blob/main/Sections/US-National/IAB%20Privacy%E2%80%99s%20National%20Privacy%20Technical%20Specification.md