@@ -8,6 +8,61 @@ const conversionTrackingId = '_conversion_id_'
88const conversionLabel = '_conversion_'
99
1010describe ( 'GoogleEnhancedConversions' , ( ) => {
11+ describe ( 'testAuthentication' , ( ) => {
12+ it ( 'should validate loginCustomerId format - valid format' , async ( ) => {
13+ await expect (
14+ testDestination . testAuthentication ( {
15+ conversionTrackingId,
16+ loginCustomerId : '123-456-7890'
17+ } )
18+ ) . resolves . not . toThrow ( )
19+ } )
20+
21+ it ( 'should validate loginCustomerId format - valid format without dashes' , async ( ) => {
22+ await expect (
23+ testDestination . testAuthentication ( {
24+ conversionTrackingId,
25+ loginCustomerId : '1234567890'
26+ } )
27+ ) . resolves . not . toThrow ( )
28+ } )
29+
30+ it ( 'should reject loginCustomerId with invalid format - too few digits' , async ( ) => {
31+ await expect (
32+ testDestination . testAuthentication ( {
33+ conversionTrackingId,
34+ loginCustomerId : '123-456-789'
35+ } )
36+ ) . rejects . toThrow ( 'Login Customer ID must be 10 digits in XXX-XXX-XXXX format' )
37+ } )
38+
39+ it ( 'should reject loginCustomerId with invalid format - too many digits' , async ( ) => {
40+ await expect (
41+ testDestination . testAuthentication ( {
42+ conversionTrackingId,
43+ loginCustomerId : '123-456-78901'
44+ } )
45+ ) . rejects . toThrow ( 'Login Customer ID must be 10 digits in XXX-XXX-XXXX format' )
46+ } )
47+
48+ it ( 'should reject loginCustomerId with invalid format - contains letters' , async ( ) => {
49+ await expect (
50+ testDestination . testAuthentication ( {
51+ conversionTrackingId,
52+ loginCustomerId : '123-456-789A'
53+ } )
54+ ) . rejects . toThrow ( 'Login Customer ID must be 10 digits in XXX-XXX-XXXX format' )
55+ } )
56+
57+ it ( 'should allow empty/undefined loginCustomerId since it is optional' , async ( ) => {
58+ await expect (
59+ testDestination . testAuthentication ( {
60+ conversionTrackingId
61+ } )
62+ ) . resolves . not . toThrow ( )
63+ } )
64+ } )
65+
1166 describe ( 'extendRequest - login-customer-id header' , ( ) => {
1267 it ( 'should include login-customer-id header when loginCustomerId is provided' , async ( ) => {
1368 const event = createTestEvent ( {
0 commit comments