Skip to content
This repository has been archived by the owner on Nov 21, 2022. It is now read-only.

Commit

Permalink
fix(vendor-mapping): use the same purpose ids for purposeIds and `l…
Browse files Browse the repository at this point in the history
…egitimateInterestIds` in result object of dumpPurposeRelations
  • Loading branch information
preventdefault committed Jun 25, 2020
1 parent a858f25 commit c516096
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
6 changes: 5 additions & 1 deletion src/vendor-mapping/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ describe('custom-vendor-grants module', () => {

configureGrants(grants);

expect(dumpPurposeRelations('5')).toEqual({ vendorIds: ['1', '2', '3'], purposeIds: ['5', '4', '8', '6'] });
expect(dumpPurposeRelations('5')).toEqual({
vendorIds: ['1', '2', '3'],
purposeIds: ['5', '4', '8', '6'],
legitimateInterestIds: ['5', '4', '8', '6'],
});
});
});
7 changes: 2 additions & 5 deletions src/vendor-mapping/api.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import { CustomVendorGrants } from '../sourcepoint/typings';
import { RelationsDump } from './typings';

const purposeRelations = new Map<string, Set<string>>();
const vendorRelations = new Map<string, Set<string>>();
const grantedVendors = new Set<string>();

type RelationsDump = {
vendorIds: string[];
purposeIds: string[];
};

const checkForRelationEntry = (map: Map<string, Set<string>>, id: string): void => {
if (!map.has(id)) {
map.set(id, new Set());
Expand Down Expand Up @@ -62,5 +58,6 @@ export const dumpPurposeRelations = (purposeId: string): RelationsDump => {
return {
vendorIds,
purposeIds: [...purposeIds],
legitimateInterestIds: [...purposeIds],
};
};
5 changes: 5 additions & 0 deletions src/vendor-mapping/typings.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export type RelationsDump = {
vendorIds: string[];
purposeIds: string[];
legitimateInterestIds: string[];
};
6 changes: 5 additions & 1 deletion src/vue/components/ConsentActions/ConsentActions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ describe('ConsentActions component', () => {
default({ consentPurpose }: { consentPurpose: (id: string) => void }): void {
consentPurpose('5');

expect(postCustomConsent).toHaveBeenCalledWith({ vendorIds: [], purposeIds: ['5'] });
expect(postCustomConsent).toHaveBeenCalledWith({
vendorIds: [],
purposeIds: ['5'],
legitimateInterestIds: ['5'],
});
},
},
});
Expand Down

0 comments on commit c516096

Please sign in to comment.