From 830cec42e9f77643e80f1ade4efffd4335c39663 Mon Sep 17 00:00:00 2001 From: matinzd <24797481+matinzd@users.noreply.github.com> Date: Wed, 14 Aug 2024 12:02:59 +0200 Subject: [PATCH] test: add hashed phone number test for modular api --- packages/analytics/__tests__/analytics.test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/analytics/__tests__/analytics.test.ts b/packages/analytics/__tests__/analytics.test.ts index 8032e8c17a..588997fa0b 100644 --- a/packages/analytics/__tests__/analytics.test.ts +++ b/packages/analytics/__tests__/analytics.test.ts @@ -881,6 +881,14 @@ describe('Analytics', function () { expect(initiateOnDeviceConversionMeasurementWithHashedEmailAddress).toBeDefined(); }); + it('`initiateOnDeviceConversionMeasurementWithHashedPhoneNumber` should throw if the value is in E.164 format', function () { + expect(() => + initiateOnDeviceConversionMeasurementWithHashedPhoneNumber(getAnalytics(), '+1234567890'), + ).toThrowError( + "firebase.analytics().initiateOnDeviceConversionMeasurementWithHashedPhoneNumber(*) 'hashedPhoneNumber' expected a sha256-hashed value of a phone number in E.164 format.", + ); + }); + it('`initiateOnDeviceConversionMeasurementWithPhoneNumber` function is properly exposed to end user', function () { expect(initiateOnDeviceConversionMeasurementWithPhoneNumber).toBeDefined(); });