@@ -9,11 +9,12 @@ var tester = require('@segment/analytics.js-integration-tester');
99describe ( 'Pendo' , function ( ) {
1010 var analytics ;
1111 var pendo ;
12- var options = {
13- apiKey : 'test-key-for-segment-integration'
14- } ;
12+ var options ;
1513
1614 beforeEach ( function ( ) {
15+ options = {
16+ apiKey : 'test-key-for-segment-integration'
17+ } ;
1718 analytics = new Analytics ( ) ;
1819 pendo = new Pendo ( options ) ;
1920
@@ -24,6 +25,7 @@ describe('Pendo', function() {
2425 } ) ;
2526
2627 afterEach ( function ( ) {
28+ delete window . pendo_options ;
2729 analytics . restore ( ) ;
2830 analytics . reset ( ) ;
2931 pendo . reset ( ) ;
@@ -60,9 +62,31 @@ describe('Pendo', function() {
6062 } ) ;
6163
6264 it ( 'should create a pendo_options object using API' , function ( ) {
65+ analytics . initialize ( ) ;
66+ analytics . assert . deepEqual ( window . pendo_options , {
67+ apiKey : options . apiKey ,
68+ usePendoAgentAPI : true ,
69+ visitor : {
70+ id : '_PENDO_T_' + analytics . user ( ) . anonymousId ( )
71+ }
72+ } ) ;
73+ } ) ;
74+
75+ it ( 'should create a pendo_options object for a user and group' , function ( ) {
76+ analytics . identify ( 'user1' , { foo : 'bar' } ) ;
77+ analytics . group ( 'group1' , { baz : 'quux' } ) ;
78+ analytics . initialize ( ) ;
6379 analytics . assert . deepEqual ( window . pendo_options , {
6480 apiKey : options . apiKey ,
65- usePendoAgentAPI : true
81+ usePendoAgentAPI : true ,
82+ visitor : {
83+ id : 'user1' ,
84+ foo : 'bar'
85+ } ,
86+ account : {
87+ id : 'group1' ,
88+ baz : 'quux'
89+ }
6690 } ) ;
6791 } ) ;
6892 } ) ;
0 commit comments