@@ -112,30 +112,6 @@ describe('Analytics', () => {
112
112
expect ( ( ) => identifyAuthenticatedUser ( null ) )
113
113
. toThrowError ( new Error ( 'UserId is required for identifyAuthenticatedUser.' ) ) ;
114
114
} ) ;
115
-
116
- it ( 'should call segment identify once' , ( ) => {
117
- const testTraits = { anything : 'Yay!' } ;
118
- identifyAuthenticatedUser ( testUserId , testTraits ) ;
119
- identifyAuthenticatedUser ( testUserId , testTraits ) ;
120
-
121
- expect ( window . analytics . identify . mock . calls . length ) . toBe ( 1 ) ;
122
- } ) ;
123
-
124
- it ( 'should call segment identify if hasIdentifyBeenCalled is false' , ( ) => {
125
- const testTraits = { anything : 'Yay!' } ;
126
- service . hasIdentifyBeenCalled = false ;
127
- identifyAuthenticatedUser ( testUserId , testTraits ) ;
128
-
129
- expect ( window . analytics . identify ) . toHaveBeenCalled ( ) ;
130
- } ) ;
131
-
132
- it ( 'should not call segment identify if hasIdentifyBeenCalled is true' , ( ) => {
133
- const testTraits = { anything : 'Yay!' } ;
134
- service . hasIdentifyBeenCalled = true ;
135
- identifyAuthenticatedUser ( testUserId , testTraits ) ;
136
-
137
- expect ( window . analytics . identify ) . not . toHaveBeenCalled ( ) ;
138
- } ) ;
139
115
} ) ;
140
116
141
117
describe ( 'analytics identifyAnonymousUser' , ( ) => {
@@ -154,33 +130,6 @@ describe('Analytics', () => {
154
130
155
131
expect ( window . analytics . reset . mock . calls . length ) . toBe ( 1 ) ;
156
132
} ) ;
157
-
158
- it ( 'should call segment reset once' , ( ) => {
159
- window . analytics . user = ( ) => ( { id : ( ) => 1 } ) ;
160
- const testTraits = { anything : 'Yay!' } ;
161
- identifyAnonymousUser ( testTraits ) ;
162
- identifyAnonymousUser ( testTraits ) ;
163
-
164
- expect ( window . analytics . reset . mock . calls . length ) . toBe ( 1 ) ;
165
- } ) ;
166
-
167
- it ( 'should call segment reset if hasIdentifyBeenCalled is false' , ( ) => {
168
- window . analytics . user = ( ) => ( { id : ( ) => 2 } ) ;
169
- const testTraits = { anything : 'Yay!' } ;
170
- service . hasIdentifyBeenCalled = false ;
171
- identifyAnonymousUser ( testTraits ) ;
172
-
173
- expect ( window . analytics . reset ) . toHaveBeenCalled ( ) ;
174
- } ) ;
175
-
176
- it ( 'should not call segment reset if hasIdentifyBeenCalled is true' , ( ) => {
177
- window . analytics . user = ( ) => ( { id : ( ) => 3 } ) ;
178
- const testTraits = { anything : 'Yay!' } ;
179
- service . hasIdentifyBeenCalled = true ;
180
- identifyAnonymousUser ( testTraits ) ;
181
-
182
- expect ( window . analytics . reset ) . not . toHaveBeenCalled ( ) ;
183
- } ) ;
184
133
} ) ;
185
134
186
135
function testSendPageAfterIdentify ( identifyFunction ) {
0 commit comments