Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
silesky committed Jun 28, 2023
1 parent f714d34 commit 281bd08
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type {
CreateWrapperSettings,
AnyAnalytics,
CDNSettings,
AnalyticsBrowserSettings,
} from '../../types'
import { CDNSettingsBuilder } from '@internal/test-helpers'

Expand All @@ -30,11 +31,11 @@ let consoleErrorSpy: jest.SpiedFunction<typeof console['error']>

const getAnalyticsLoadLastCall = () => {
const [arg1, arg2] = analyticsLoadSpy.mock.lastCall
const cdnSettings = arg1.cdnSettings
const cdnSettings = (arg1 as any).cdnSettings as CDNSettings
const updateCDNSettings = arg2!.updateCDNSettings || ((id) => id)
const updatedCDNSettings = updateCDNSettings(cdnSettings) as CDNSettings
return {
args: [arg1, arg2],
args: [arg1 as AnalyticsBrowserSettings, arg2!] as const,
cdnSettings,
updatedCDNSettings,
}
Expand Down Expand Up @@ -346,7 +347,6 @@ describe(createWrapper, () => {

await analytics.load({
...DEFAULT_LOAD_SETTINGS,
getCategories: () => ({ Advertising: true }),
cdnSettings: mockCdnSettings,
})

Expand Down
7 changes: 2 additions & 5 deletions packages/consent/consent-tools/src/types/wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import type { CreateWrapperSettings } from './settings'

/**
* first argument to AnalyticsBrowser.load
*/
export interface AnalyticsBrowserSettings {
writeKey: string
cdnURL?: string
Expand Down Expand Up @@ -30,10 +27,10 @@ export interface AnyAnalytics {
* Either window.analytics.load(...) OR AnalyticsBrowser.load(...)
*/
load(
writeKeyOrSettings: any,
writeKeyOrSettings: AnalyticsBrowserSettings | string, // sorry for the any, this should beAnalyticsBrowserSettings | string, but TS errors in tests
/** See analytics-next function signature for more information. */
options?: InitOptions
): any
): void
}

/**
Expand Down

0 comments on commit 281bd08

Please sign in to comment.