Skip to content

Commit e692110

Browse files
Address PR Comments
1 parent ec11dc8 commit e692110

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

test/jest/types.spec.ts

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,6 @@ describe('CommerceEventType', () => {
180180
expect(ProductRemoveFromWishlist).toEqual(21);
181181
expect(ProductImpression).toEqual(22);
182182
});
183-
184-
describe('#getName', () => {
185-
186-
});
187183
});
188184

189185
describe('IdentityType', () => {
@@ -221,7 +217,8 @@ describe('IdentityType', () => {
221217
expect(Yahoo).toEqual(6);
222218
expect(Email).toEqual(7);
223219

224-
// There is no value for 8
220+
// 8 was used for `Alias` but this is now hanled by Identity directly
221+
// and will no longer be sent as an IdentityType
225222

226223
expect(FacebookCustomAudienceId).toEqual(9);
227224
expect(Other2).toEqual(10);
@@ -303,7 +300,7 @@ describe('IdentityType', () => {
303300
});
304301
});
305302

306-
describe('#getNewIdentitesByName', () => {
303+
describe('#getNewIdentitiesByName', () => {
307304
it('returns an identity name when passing an identity type', () => {
308305
const { getNewIdentitiesByName } = IdentityType;
309306

@@ -318,16 +315,29 @@ describe('IdentityType', () => {
318315
});
319316
});
320317

321-
it('returns an empty object if the identity type is not found', () => {
318+
it('returns an empty object if identity types are not found', () => {
322319
const { getNewIdentitiesByName } = IdentityType;
323320

324321
const newIdentitiesByType = {
325-
[NaN]: 'not-a-number',
326322
['invalid']: 'not-valid',
327323
};
328324

329325
expect(getNewIdentitiesByName(newIdentitiesByType)).toEqual({});
330326
});
327+
328+
it('removes invalid identity types', () => {
329+
const { getNewIdentitiesByName } = IdentityType;
330+
331+
const newIdentitiesByType = {
332+
[NaN]: 'not-a-number',
333+
['invalid']: 'not-valid',
334+
[Email]: 'bar@gmail.com',
335+
};
336+
337+
expect(getNewIdentitiesByName(newIdentitiesByType)).toEqual({
338+
email: 'bar@gmail.com',
339+
});
340+
});
331341
});
332342

333343
describe('#getIdentityName', () => {
@@ -380,6 +390,7 @@ describe('IdentityType', () => {
380390
expect(getName(FacebookCustomAudienceId)).toBe('Facebook App User ID');
381391
});
382392

393+
// https://go.mparticle.com/work/SQDSDKS-6942
383394
it('returns other if the identity type is not found', () => {
384395
const { getName } = IdentityType;
385396

0 commit comments

Comments
 (0)