@@ -1721,9 +1721,11 @@ describe('batch uploader', () => {
17211721 describe ( 'noFunctional' , ( ) => {
17221722 const eventStorageKey = 'mprtcl-v4_abcdef-events' ;
17231723 const batchStorageKey = 'mprtcl-v4_abcdef-batches' ;
1724-
1725- it ( 'should write session storage when noFunctional is default (false)' , async ( ) => {
1724+ beforeEach ( ( ) => {
17261725 window . mParticle . _resetForTests ( MPConfig ) ;
1726+ } ) ;
1727+
1728+ it ( 'should store events in session storage when noFunctional is default (false)' , async ( ) => {
17271729 window . mParticle . config . flags = {
17281730 offlineStorage : '100' ,
17291731 ...enableBatchingConfigFlags ,
@@ -1736,12 +1738,15 @@ describe('batch uploader', () => {
17361738 expect ( ! ! window . sessionStorage . getItem ( eventStorageKey ) ) . to . equal ( true ) ;
17371739 } ) ;
17381740
1739- it ( 'should NOT write session storage when noFunctional is true' , async ( ) => {
1740- window . mParticle . _resetForTests ( { ...MPConfig , noFunctional : true } ) ;
1741+ it ( 'should NOT store events in session storage when noFunctional is true' , async ( ) => {
17411742 window . mParticle . config . flags = {
17421743 offlineStorage : '100' ,
17431744 ...enableBatchingConfigFlags ,
17441745 } ;
1746+ window . mParticle . config . launcherOptions = {
1747+ ...( window . mParticle . config . launcherOptions || { } ) ,
1748+ noFunctional : true ,
1749+ } ;
17451750 window . mParticle . init ( apiKey , window . mParticle . config ) ;
17461751 await waitForCondition ( hasIdentifyReturned ) ;
17471752 const mpInstance = window . mParticle . getInstance ( ) ;
@@ -1751,12 +1756,15 @@ describe('batch uploader', () => {
17511756 expect ( window . sessionStorage . getItem ( eventStorageKey ) === '' ) . to . equal ( true ) ;
17521757 } ) ;
17531758
1754- it ( 'should write session storage when noFunctional is false' , async ( ) => {
1755- window . mParticle . _resetForTests ( { ...MPConfig , noFunctional : false } ) ;
1759+ it ( 'should store events in session storage when noFunctional is false' , async ( ) => {
17561760 window . mParticle . config . flags = {
17571761 offlineStorage : '100' ,
17581762 ...enableBatchingConfigFlags ,
17591763 } ;
1764+ window . mParticle . config . launcherOptions = {
1765+ ...( window . mParticle . config . launcherOptions || { } ) ,
1766+ noFunctional : false ,
1767+ } ;
17601768 window . mParticle . init ( apiKey , window . mParticle . config ) ;
17611769 await waitForCondition ( hasIdentifyReturned ) ;
17621770 const mpInstance = window . mParticle . getInstance ( ) ;
@@ -1765,8 +1773,7 @@ describe('batch uploader', () => {
17651773 expect ( ! ! window . sessionStorage . getItem ( eventStorageKey ) ) . to . equal ( true ) ;
17661774 } ) ;
17671775
1768- it ( 'should write local storage when noFunctional is default (false)' , async ( ) => {
1769- window . mParticle . _resetForTests ( MPConfig ) ;
1776+ it ( 'should store batches in local storage when noFunctional is default (false)' , async ( ) => {
17701777 window . mParticle . init ( apiKey , window . mParticle . config ) ;
17711778 await waitForCondition ( hasIdentifyReturned ) ;
17721779 const mpInstance = window . mParticle . getInstance ( ) ;
@@ -1777,8 +1784,15 @@ describe('batch uploader', () => {
17771784 expect ( ! ! window . localStorage . getItem ( batchStorageKey ) ) . to . equal ( true ) ;
17781785 } ) ;
17791786
1780- it ( 'should NOT write local storage when noFunctional is true' , async ( ) => {
1781- window . mParticle . _resetForTests ( { ...MPConfig , noFunctional : true } ) ;
1787+ it ( 'should NOT store batches in local storage when noFunctional is true' , async ( ) => {
1788+ window . mParticle . config . flags = {
1789+ offlineStorage : '100' ,
1790+ ...enableBatchingConfigFlags ,
1791+ } ;
1792+ window . mParticle . config . launcherOptions = {
1793+ ...( window . mParticle . config . launcherOptions || { } ) ,
1794+ noFunctional : true ,
1795+ } ;
17821796 window . mParticle . init ( apiKey , window . mParticle . config ) ;
17831797 await waitForCondition ( hasIdentifyReturned ) ;
17841798 const mpInstance = window . mParticle . getInstance ( ) ;
@@ -1788,8 +1802,15 @@ describe('batch uploader', () => {
17881802 expect ( window . localStorage . getItem ( batchStorageKey ) === '' ) . to . equal ( true ) ;
17891803 } ) ;
17901804
1791- it ( 'should write local storage when noFunctional is false' , async ( ) => {
1792- window . mParticle . _resetForTests ( { ...MPConfig , noFunctional : false } ) ;
1805+ it ( 'should store batches in local storage when noFunctional is false' , async ( ) => {
1806+ window . mParticle . config . flags = {
1807+ offlineStorage : '100' ,
1808+ ...enableBatchingConfigFlags ,
1809+ } ;
1810+ window . mParticle . config . launcherOptions = {
1811+ ...( window . mParticle . config . launcherOptions || { } ) ,
1812+ noFunctional : false ,
1813+ } ;
17931814 window . mParticle . init ( apiKey , window . mParticle . config ) ;
17941815 await waitForCondition ( hasIdentifyReturned ) ;
17951816 const mpInstance = window . mParticle . getInstance ( ) ;
0 commit comments