From 383b3c545f5659c450d9ec205cfa4cefe3e2ea90 Mon Sep 17 00:00:00 2001 From: Shepherd Date: Thu, 6 Jun 2024 11:53:06 -0400 Subject: [PATCH] Fix typeError in operation repo test Fixes "TypeError: Cannot destructure property 'lastKnownPushToken' of '(intermediate value)' as it is undefined." --- __test__/unit/core/operationRepo.test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/__test__/unit/core/operationRepo.test.ts b/__test__/unit/core/operationRepo.test.ts index 50a3516c8..c197930f9 100644 --- a/__test__/unit/core/operationRepo.test.ts +++ b/__test__/unit/core/operationRepo.test.ts @@ -2,6 +2,7 @@ import { DELTA_QUEUE_TIME_ADVANCE, DUMMY_MODEL_ID, DUMMY_ONESIGNAL_ID, + DUMMY_PUSH_TOKEN, } from '../../support/constants'; import ModelCache from '../../../src/core/caching/ModelCache'; import ExecutorBase from '../../../src/core/executors/ExecutorBase'; @@ -22,6 +23,7 @@ import { } from '../../support/helpers/core'; import { TestEnvironment } from '../../support/environment/TestEnvironment'; import { Operation } from '../../../src/core/operationRepo/Operation'; +import Database from '../../../src/shared/services/Database'; let broadcastCount = 0; @@ -198,6 +200,14 @@ describe('OperationRepo tests', () => { test('Update User Properties: -> one operation of change type: update', (done: jest.DoneCallback) => { test.stub(Operation, 'getInstanceWithModelReference'); + test.stub( + Database, + 'getAppState', + Promise.resolve({ + lastKnownPushToken: DUMMY_PUSH_TOKEN, + }), + ); + const { modelRepo, operationRepo } = OneSignal.coreDirector.core; const executor = operationRepo?.executorStore.store[ModelName.Properties];