Skip to content

Commit 3d87fe2

Browse files
Save Point
1 parent a45d30f commit 3d87fe2

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

src/apiClient.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ export default function APIClient(
135135
this.queueEventForBatchUpload(event);
136136
}
137137

138-
if (event.EventName !== Types.MessageType.AppStateTransition.toString()) {
138+
// While Event Name is 'usually' a string, there are some cases where it is a number
139+
// in that it could be a type of MessageType Enum
140+
if (event.EventName as unknown as number !== Types.MessageType.AppStateTransition) {
139141
if (kitBlocker && kitBlocker.kitBlockingEnabled) {
140142
event = kitBlocker.createBlockedEvent(event);
141143
}

test/src/tests-forwarders.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2032,7 +2032,7 @@ describe('forwarders', function() {
20322032
});
20332033
});
20342034

2035-
it('should not forward event if event attribute forwarding rule is set and includeOnMatch is false', function(done) {
2035+
it('should not forward event if event attribute forwarding rule is set and includeOnMatch is false', async () => {
20362036
mParticle._resetForTests(MPConfig);
20372037
const mockForwarder = new MockForwarder();
20382038
mockForwarder.register(window.mParticle.config);
@@ -2048,12 +2048,8 @@ describe('forwarders', function() {
20482048
window.mParticle.config.kitConfigs.push(config1);
20492049

20502050
mParticle.init(apiKey, window.mParticle.config);
2051-
waitForCondition(() => {
2052-
return (
2053-
window.mParticle.getInstance()?._Store?.identityCallInFlight === false
2054-
);
2055-
})
2056-
.then(() => {
2051+
await waitForCondition(hasIdentityCallInflightReturned);
2052+
20572053
window.MockForwarder1.instance.receivedEvent.EventName.should.equal(1);
20582054
window.MockForwarder1.instance.receivedEvent = null;
20592055

@@ -2069,8 +2065,6 @@ describe('forwarders', function() {
20692065

20702066
Should(event).not.be.ok();
20712067

2072-
done();
2073-
});
20742068
});
20752069

20762070
it('should forward event if event attribute forwarding rule is set and includeOnMatch is false but attributes do not match', async () => {
@@ -2090,11 +2084,7 @@ describe('forwarders', function() {
20902084
window.mParticle.config.kitConfigs.push(config1);
20912085

20922086
mParticle.init(apiKey, window.mParticle.config);
2093-
await waitForCondition(() => {
2094-
return (
2095-
window.mParticle.getInstance()?._Store?.identityCallInFlight === false
2096-
);
2097-
})
2087+
await waitForCondition(hasIdentityCallInflightReturned);
20982088

20992089
window.MockForwarder1.instance.receivedEvent.EventName.should.equal(1);
21002090
window.MockForwarder1.instance.receivedEvent = null;

0 commit comments

Comments
 (0)