Skip to content

Commit 0d4e6a7

Browse files
committed
add test
1 parent 413f97c commit 0d4e6a7

File tree

1 file changed

+41
-0
lines changed
  • packages/browser/src/plugins/schema-filter/__tests__

1 file changed

+41
-0
lines changed

packages/browser/src/plugins/schema-filter/__tests__/index.test.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ const settings: LegacySettings = {
1010
'Braze Web Mode (Actions)': {},
1111
// note that Fullstory's name here doesn't contain 'Actions'
1212
Fullstory: {},
13+
'Google Analytics': {},
14+
'Google Analytics 4 Web': {},
1315
'Segment.io': {},
1416
},
1517
remotePlugins: [
@@ -49,6 +51,19 @@ const settings: LegacySettings = {
4951
],
5052
},
5153
},
54+
{
55+
name: 'Google Analytics 4 Web',
56+
creationName: 'Google Analytics 4 Web',
57+
libraryName: 'google-analytics-4-webDestination',
58+
url: 'https://cdn.segment.com/next-integrations/actions/google-analytics-4-web/bfab87631cbcb7d70964.js',
59+
settings: {
60+
subscriptions: [
61+
{
62+
partnerAction: 'Custom Event',
63+
},
64+
],
65+
},
66+
},
5267
],
5368
}
5469

@@ -92,6 +107,11 @@ const fullstory: Plugin = {
92107
name: 'Fullstory (Actions) trackEvent',
93108
}
94109

110+
const ga4: Plugin = {
111+
...trackEvent,
112+
name: 'Google Analytics 4 Web Custom Event',
113+
}
114+
95115
describe('schema filter', () => {
96116
let options: SegmentioSettings
97117
let filterXt: Plugin
@@ -113,6 +133,7 @@ describe('schema filter', () => {
113133
jest.spyOn(updateUserProfile, 'track')
114134
jest.spyOn(amplitude, 'track')
115135
jest.spyOn(fullstory, 'track')
136+
jest.spyOn(ga4, 'track')
116137
})
117138

118139
describe('plugins and destinations', () => {
@@ -516,5 +537,25 @@ describe('schema filter', () => {
516537
expect(updateUserProfile.track).toHaveBeenCalled()
517538
expect(fullstory.track).toHaveBeenCalled()
518539
})
540+
541+
it('doesnt block destinations with similar names', async () => {
542+
const filterXt = schemaFilter(
543+
{
544+
hi: {
545+
enabled: true,
546+
integrations: {
547+
'Google Analytics': false,
548+
},
549+
},
550+
},
551+
settings
552+
)
553+
554+
await ajs.register(segment, ga4, filterXt)
555+
556+
await ajs.track('hi')
557+
558+
expect(ga4.track).toHaveBeenCalled()
559+
})
519560
})
520561
})

0 commit comments

Comments
 (0)