@@ -226,20 +226,21 @@ describe('Pixel', () => {
226226 } ) ;
227227
228228 describe ( 'identify' , ( ) => {
229- it ( 'enqueues identify message at full consent' , ( ) => {
229+ it ( 'enqueues identify message with identityType at full consent' , ( ) => {
230230 mockGetOrCreateSession . mockReturnValue ( { sessionId : 'session-abc' , isNew : false } ) ;
231231
232232 const pixel = new Pixel ( ) ;
233233 activePixel = pixel ;
234234 pixel . init ( { key : 'pk_test' , environment : 'dev' , consent : 'full' } ) ;
235235 mockEnqueue . mockClear ( ) ;
236236
237- pixel . identify ( 'user-1' , { email : 'test@example.com' } ) ;
237+ pixel . identify ( 'user-1' , 'passport' , { email : 'test@example.com' } ) ;
238238
239239 expect ( mockEnqueue ) . toHaveBeenCalledWith (
240240 expect . objectContaining ( {
241241 type : 'identify' ,
242242 userId : 'user-1' ,
243+ identityType : 'passport' ,
243244 surface : 'pixel' ,
244245 traits : expect . objectContaining ( {
245246 email : 'test@example.com' ,
@@ -249,12 +250,31 @@ describe('Pixel', () => {
249250 ) ;
250251 } ) ;
251252
253+ it ( 'enqueues identify message without traits' , ( ) => {
254+ mockGetOrCreateSession . mockReturnValue ( { sessionId : 'session-abc' , isNew : false } ) ;
255+
256+ const pixel = new Pixel ( ) ;
257+ activePixel = pixel ;
258+ pixel . init ( { key : 'pk_test' , environment : 'dev' , consent : 'full' } ) ;
259+ mockEnqueue . mockClear ( ) ;
260+
261+ pixel . identify ( 'steam-id-123' , 'steam' ) ;
262+
263+ expect ( mockEnqueue ) . toHaveBeenCalledWith (
264+ expect . objectContaining ( {
265+ type : 'identify' ,
266+ userId : 'steam-id-123' ,
267+ identityType : 'steam' ,
268+ } ) ,
269+ ) ;
270+ } ) ;
271+
252272 it ( 'does not enqueue identify at anonymous consent' , ( ) => {
253273 const pixel = new Pixel ( ) ;
254274 activePixel = pixel ;
255275 pixel . init ( { key : 'pk_test' , environment : 'dev' , consent : 'anonymous' } ) ;
256276
257- pixel . identify ( 'user-1' ) ;
277+ pixel . identify ( 'user-1' , 'passport' ) ;
258278 // Only the auto page view + session_start, no identify
259279 const calls = mockEnqueue . mock . calls . map ( ( c : unknown [ ] ) => ( c [ 0 ] as Record < string , unknown > ) ) ;
260280 expect ( calls . find ( ( c ) => c . type === 'identify' ) ) . toBeUndefined ( ) ;
0 commit comments