Skip to content

Commit 061bc9f

Browse files
committed
unit test added
1 parent 1e5077a commit 061bc9f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/src/tests-kit-blocking.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import KitBlocker from '../../src/kitBlocking';
77
import Types from '../../src/types';
88
import { DataPlanVersion } from '@mparticle/data-planning-models';
99
import fetchMock from 'fetch-mock/esm/client';
10+
import { expect } from 'chai'
1011
const { findBatch, waitForCondition, fetchMockSuccess, hasIdentifyReturned } = Utils;
1112

1213
let 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, /Cannot read properties of undefined \(reading 'unplannedAttr'\)/)
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

Comments
 (0)