Skip to content

Commit

Permalink
Get first value of gppData.parsedSections
Browse files Browse the repository at this point in the history
  • Loading branch information
arelra committed Nov 21, 2024
1 parent ed6da12 commit fa2491c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getGPPData } from './api';
export const getConsentState: () => Promise<USNATConsentState> = 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
Expand Down

0 comments on commit fa2491c

Please sign in to comment.