|
1 | 1 | import { IKitConfigs } from "../../src/configAPIClient"; |
2 | 2 | import { IMParticleUser } from "../../src/identity-user-interfaces"; |
3 | 3 | import { SDKIdentityApi } from "../../src/identity.interfaces"; |
| 4 | +import { ErrorCodes } from "../../src/logging/errorCodes"; |
4 | 5 | import { IMParticleWebSDKInstance } from "../../src/mp-instance"; |
5 | 6 | import RoktManager, { IRoktKit, IRoktSelectPlacementsOptions } from "../../src/roktManager"; |
6 | 7 | import { testMPID } from '../src/config/constants'; |
@@ -554,7 +555,8 @@ describe('RoktManager', () => { |
554 | 555 |
|
555 | 556 | // Verify error was logged for non-existent method |
556 | 557 | expect(mockMPInstance.Logger.error).toHaveBeenCalledWith( |
557 | | - 'RoktManager: Method nonExistentMethod not found' |
| 558 | + 'RoktManager: Method nonExistentMethod not found', |
| 559 | + ErrorCodes.ROKT_MANAGER |
558 | 560 | ); |
559 | 561 |
|
560 | 562 | // Verify message was removed from queue even though method didn't exist |
@@ -1030,8 +1032,10 @@ describe('RoktManager', () => { |
1030 | 1032 | } |
1031 | 1033 | }, expect.any(Function)); |
1032 | 1034 | expect(mockMPInstance.Logger.warning).toHaveBeenCalledWith( |
1033 | | - 'Email mismatch detected. Current email differs from email passed to selectPlacements call. Proceeding to call identify with email from selectPlacements call. Please verify your implementation.' |
| 1035 | + 'Email mismatch detected. Current email differs from email passed to selectPlacements call. Proceeding to call identify with email from selectPlacements call. Please verify your implementation.', |
| 1036 | + ErrorCodes.EMAIL_MISMATCH |
1034 | 1037 | ); |
| 1038 | + expect(mockMPInstance.Logger.error).not.toHaveBeenCalled(); |
1035 | 1039 | }); |
1036 | 1040 |
|
1037 | 1041 | it('should not call identify when email matches current user email', () => { |
@@ -1217,7 +1221,8 @@ describe('RoktManager', () => { |
1217 | 1221 | } |
1218 | 1222 | }, expect.any(Function)); |
1219 | 1223 | expect(mockMPInstance.Logger.warning).toHaveBeenCalledWith( |
1220 | | - "emailsha256 mismatch detected. Current mParticle hashedEmail differs from hashedEmail passed to selectPlacements call. Proceeding to call identify with hashedEmail from selectPlacements call. Please verify your implementation." |
| 1224 | + "emailsha256 mismatch detected. Current mParticle hashedEmail differs from hashedEmail passed to selectPlacements call. Proceeding to call identify with hashedEmail from selectPlacements call. Please verify your implementation.", |
| 1225 | + ErrorCodes.EMAILSHA256_MISMATCH |
1221 | 1226 | ); |
1222 | 1227 | }); |
1223 | 1228 |
|
@@ -1307,7 +1312,8 @@ describe('RoktManager', () => { |
1307 | 1312 | } |
1308 | 1313 | }, expect.any(Function)); |
1309 | 1314 | expect(mockMPInstance.Logger.warning).toHaveBeenCalledWith( |
1310 | | - "emailsha256 mismatch detected. Current mParticle hashedEmail differs from hashedEmail passed to selectPlacements call. Proceeding to call identify with hashedEmail from selectPlacements call. Please verify your implementation." |
| 1315 | + "emailsha256 mismatch detected. Current mParticle hashedEmail differs from hashedEmail passed to selectPlacements call. Proceeding to call identify with hashedEmail from selectPlacements call. Please verify your implementation.", |
| 1316 | + ErrorCodes.EMAILSHA256_MISMATCH |
1311 | 1317 | ); |
1312 | 1318 | }); |
1313 | 1319 |
|
@@ -1396,7 +1402,8 @@ describe('RoktManager', () => { |
1396 | 1402 |
|
1397 | 1403 | // Verify error was logged |
1398 | 1404 | expect(mockMPInstance.Logger.error).toHaveBeenCalledWith( |
1399 | | - 'Failed to identify user with new email: ' + JSON.stringify(mockError) |
| 1405 | + 'Failed to identify user with new email: ' + JSON.stringify(mockError), |
| 1406 | + ErrorCodes.ROKT_MANAGER |
1400 | 1407 | ); |
1401 | 1408 |
|
1402 | 1409 | // Verify selectPlacements was still called |
|
0 commit comments