@@ -1904,6 +1904,59 @@ describe('persistence', () => {
19041904
19051905 expect ( getLocalStorage ( ) ) . to . not . be . ok ;
19061906 } ) ;
1907+
1908+ it ( 'should allow identity calls and event sending without any persistence data' , async ( ) => {
1909+ mParticle . config . useCookieStorage = false ;
1910+ mParticle . init ( apiKey , mParticle . config ) ;
1911+
1912+ await waitForCondition ( hasIdentifyReturned ) ;
1913+
1914+ // Verify identity call was made
1915+ const identityCalls = fetchMock . calls ( ) . filter ( call =>
1916+ call [ 0 ] . includes ( '/identify' )
1917+ ) ;
1918+ expect ( identityCalls . length ) . to . equal ( 1 ) ;
1919+
1920+ const identityData = JSON . parse ( identityCalls [ 0 ] [ 1 ] . body as string ) ;
1921+ expect ( identityData ) . to . have . property ( 'known_identities' ) ;
1922+
1923+ // Should have a device_application_stamp generated by SDK
1924+ expect ( identityData . known_identities ) . to . have . property ( 'device_application_stamp' ) ;
1925+ expect ( identityData . known_identities . device_application_stamp ) . to . be . a ( 'string' ) ;
1926+
1927+ // Reset for event test
1928+ fetchMock . resetHistory ( ) ;
1929+
1930+ // Test 2: Event sending should work without persistence data
1931+ mParticle . logEvent ( 'No Persistence Test Event' ) ;
1932+
1933+ // Verify event was sent
1934+ const eventCalls = fetchMock . calls ( ) . filter ( call =>
1935+ call [ 0 ] . includes ( '/events' )
1936+ ) ;
1937+
1938+ expect ( eventCalls . length ) . to . be . greaterThan ( 0 ) ;
1939+
1940+ const eventCall = eventCalls . find ( call =>
1941+ ( call [ 1 ] . body as string ) . includes ( 'No Persistence Test Event' )
1942+ ) ;
1943+ expect ( eventCall ) . to . be . ok ;
1944+
1945+ const eventBatch = JSON . parse ( eventCall [ 1 ] . body as string ) ;
1946+ expect ( eventBatch ) . to . have . property ( 'events' ) ;
1947+ expect ( eventBatch . events . length ) . to . be . greaterThan ( 0 ) ;
1948+
1949+ const testEvent = eventBatch . events . find ( event =>
1950+ event . data && event . data . event_name === 'No Persistence Test Event'
1951+ ) ;
1952+ expect ( testEvent ) . to . be . ok ;
1953+
1954+ expect ( findCookie ( ) ) . to . not . be . ok ;
1955+ expect ( getLocalStorage ( ) ) . to . not . be . ok ;
1956+
1957+ const store = mParticle . getInstance ( ) . _Store ;
1958+ expect ( identityData . known_identities . device_application_stamp ) . to . equal ( store . deviceId ) ;
1959+ } ) ;
19071960 } ) ;
19081961
19091962 describe ( 'set to false' , ( ) => {
0 commit comments