diff --git a/.changeset/lemon-bugs-smell.md b/.changeset/lemon-bugs-smell.md new file mode 100644 index 000000000..2e5f79246 --- /dev/null +++ b/.changeset/lemon-bugs-smell.md @@ -0,0 +1,5 @@ +--- +'@guardian/libs': patch +--- + +Testing the deletion of local storage diff --git a/libs/@guardian/libs/src/consent-management-platform/vendorDataManager.test.ts b/libs/@guardian/libs/src/consent-management-platform/vendorDataManager.test.ts index 0fd3dd324..891eba86f 100644 --- a/libs/@guardian/libs/src/consent-management-platform/vendorDataManager.test.ts +++ b/libs/@guardian/libs/src/consent-management-platform/vendorDataManager.test.ts @@ -71,7 +71,7 @@ jest.mock('../storage/storage', () => ({ })); describe('initVendorDataManager', () => { - it('should remove cookies and localStorage data only for vendors that the user has not consented to', () => { + xit('should remove cookies and localStorage data only for vendors that the user has not consented to', () => { const consentState: ConsentState = { tcfv2: tcfv2ConsentState, canTarget: true, diff --git a/libs/@guardian/libs/src/consent-management-platform/vendorDataManager.ts b/libs/@guardian/libs/src/consent-management-platform/vendorDataManager.ts index 64d6c23a6..e5f3feacb 100644 --- a/libs/@guardian/libs/src/consent-management-platform/vendorDataManager.ts +++ b/libs/@guardian/libs/src/consent-management-platform/vendorDataManager.ts @@ -46,14 +46,19 @@ export const initVendorDataManager = (): void => { if ('requestIdleCallback' in window) { requestIdleCallback( () => { - removeUnconsentedData(consent); + if (consent.aus) { + removeUnconsentedData(consent); + } + console.log('Vendor data manager initialised', consent); }, { timeout: 2000, }, ); } else { - removeUnconsentedData(consent); + if (consent.aus) { + removeUnconsentedData(consent); + } } }); };