@@ -7,6 +7,7 @@ import KitBlocker from '../../src/kitBlocking';
77import Types from '../../src/types' ;
88import { DataPlanVersion } from '@mparticle/data-planning-models' ;
99import fetchMock from 'fetch-mock/esm/client' ;
10+ import { expect } from 'chai'
1011const { findBatch, waitForCondition, fetchMockSuccess, hasIdentifyReturned } = Utils ;
1112
1213let forwarderDefaultConfiguration = Utils . forwarderDefaultConfiguration ,
@@ -616,6 +617,24 @@ describe('kit blocking', () => {
616617 } )
617618 } ) ;
618619
620+ it ( 'integration test - should not throw an error when unplanned user attributes are allowed and block.ua = true' , function ( done ) {
621+ window . mParticle . config . kitConfigs . push ( forwarderDefaultConfiguration ( 'MockForwarder' ) ) ;
622+ window . mParticle . init ( apiKey , window . mParticle . config ) ;
623+
624+ //save old data points for reset later
625+ const oldDataPoints = dataPlan . dtpn . vers . version_document . data_points ;
626+ dataPlan . dtpn . vers . version_document . data_points = [ ] ;
627+ let kitBlocker = new KitBlocker ( kitBlockerDataPlan , window . mParticle . getInstance ( ) ) ;
628+
629+ expect ( ( ) => { kitBlocker . isAttributeKeyBlocked ( 'unplannedAttr' ) } ) . to . not . throw ( TypeError , / C a n n o t r e a d p r o p e r t i e s o f u n d e f i n e d \( r e a d i n g ' u n p l a n n e d A t t r ' \) / )
630+
631+ //reset data points
632+ dataPlan . dtpn . vers . version_document . data_points = oldDataPoints ;
633+
634+ done ( ) ;
635+
636+ } ) ;
637+
619638 it ( 'integration test - should allow an unplanned attribute to be set on forwarder if additionalProperties = true and blok.ua = true' , function ( done ) {
620639 let userAttributeDataPoint = dataPlan . dtpn . vers . version_document . data_points . find ( dataPoint => {
621640 return dataPoint . match . type === 'user_attributes'
0 commit comments