-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
94 additions
and
44 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
...nsent/consent-tools/src/domain/__tests__/assertions/assert-integration-in-cdn-settings.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { CDNSettings } from '../../../types' | ||
|
||
/** | ||
* Assert integrations/remote plugins contain only the given integrations | ||
*/ | ||
export const assertIntegrationsContainOnly = ( | ||
/** | ||
* integration creation names | ||
*/ | ||
creationNames: string[], | ||
/** | ||
* mock CDN settings | ||
*/ | ||
originalCDNSettings: CDNSettings, | ||
/** | ||
* updated CDN settings | ||
*/ | ||
updatedCDNSettings: CDNSettings | ||
) => { | ||
expect(updatedCDNSettings.remotePlugins).toEqual( | ||
originalCDNSettings.remotePlugins?.filter((p) => | ||
// enabled consent | ||
creationNames.includes(p.creationName) | ||
) | ||
) | ||
|
||
// integrations should also be filtered | ||
const integrations = Object.fromEntries( | ||
Object.entries(originalCDNSettings.integrations).filter( | ||
([creationName]) => { | ||
return [...creationNames, 'Segment.io'].includes(creationName) | ||
} | ||
) | ||
) | ||
|
||
expect(updatedCDNSettings.integrations).toEqual(integrations) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters