Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/destination-actions/src/destinations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ register('61957755c4d820be968457de', './salesforce')
register('62e30bad99f1bfb98ee8ce08', './salesforce-marketing-cloud')
register('5f7dd8e302173ff732db5cc4', './slack')
register('6261a8b6cb4caa70e19116e8', './snap-conversions-api')
register('000000000000000000000000', './snap-conversions-v3')
register('6234b137d3b6404a64f2a0f0', './talon-one')
register('615cae349d109d6b7496a131', './tiktok-conversions')
register('63d2e550fb90f1632ed8820a', './tiktok-audiences')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { mapEventName, EVENT_NAME_MAPPING } from '../eventMapping'

describe('Event Name Mapping', () => {
it('should map known Segment events to Snapchat event names', () => {
expect(mapEventName('Product Added')).toBe('ADD_CART')
expect(mapEventName('Product Viewed')).toBe('VIEW_CONTENT')
expect(mapEventName('Order Completed')).toBe('PURCHASE')
expect(mapEventName('Checkout Started')).toBe('START_CHECKOUT')
expect(mapEventName('Signed Up')).toBe('SIGN_UP')
expect(mapEventName('Login')).toBe('LOGIN')
expect(mapEventName('Signed In')).toBe('LOGIN')
})

it('should return original event name for unknown events', () => {
expect(mapEventName('Custom Event')).toBe('Custom Event')
expect(mapEventName('CUSTOM_EVENT_1')).toBe('CUSTOM_EVENT_1')
})

it('should handle undefined event names', () => {
expect(mapEventName(undefined)).toBeUndefined()
})

it('should include all required mappings from specification', () => {
// Verify all mappings from the issue specification are included
const requiredMappings = {
'Product Added': 'ADD_CART',
'Product Added to Wishlist': 'ADD_TO_WISHLIST',
'Checkout Started': 'START_CHECKOUT',
'Order Completed': 'PURCHASE',
'Product Viewed': 'VIEW_CONTENT',
'Products Searched': 'SEARCH',
'Signed Up': 'SIGN_UP',
'Login': 'LOGIN',
'Page Viewed': 'PAGE_VIEW',
'Application Installed': 'APP_INSTALL',
'Application Opened': 'APP_OPEN',
'Product List Viewed': 'LIST_VIEW',
'Shared': 'SHARE',
'Payment Info Entered': 'ADD_BILLING'
}

Object.entries(requiredMappings).forEach(([segmentEvent, snapchatEvent]) => {
expect(EVENT_NAME_MAPPING[segmentEvent]).toBe(snapchatEvent)
})
})
})
Loading