diff --git a/sdk/nodejs/__tests__/initialize.spec.ts b/sdk/nodejs/__tests__/initialize.spec.ts index 492d42685..726c87b5a 100644 --- a/sdk/nodejs/__tests__/initialize.spec.ts +++ b/sdk/nodejs/__tests__/initialize.spec.ts @@ -1,8 +1,4 @@ -import { - DevCycleClient, - DevCycleCloudClient, - initializeDevCycle, -} from '../src/index' +import { DevCycleCloudClient, initializeDevCycle } from '../src/index' jest.mock('../src/bucketing') jest.mock('@devcycle/config-manager') @@ -12,13 +8,21 @@ describe('NodeJS SDK Initialize', () => { jest.clearAllMocks() }) - it('sucessfully calls initialize with no options', async () => { - const client: DevCycleClient = await initializeDevCycle( + it('successfully calls initialize with no options', async () => { + const client = await initializeDevCycle( 'dvc_server_token', ).onClientInitialized() expect(client).toBeDefined() }) + it('successfully creates a OpenFeature provider', async () => { + const provider = await initializeDevCycle( + 'dvc_server_token', + ).getOpenFeatureProvider() + expect(provider).toBeDefined() + expect(provider.status).toBe('READY') + }) + it('fails to initialize in Local Bucketing mode when no token is provided', () => { expect(() => initializeDevCycle(undefined as unknown as string), diff --git a/sdk/nodejs/src/__mocks__/bucketing.ts b/sdk/nodejs/src/__mocks__/bucketing.ts index 5e63fc9c8..836d74683 100644 --- a/sdk/nodejs/src/__mocks__/bucketing.ts +++ b/sdk/nodejs/src/__mocks__/bucketing.ts @@ -41,6 +41,8 @@ export const importBucketingLib = async (): Promise => { .mockReturnValue(JSON.stringify(testVariable)), variableForUser_PB: jest.fn().mockReturnValue(buffer), VariableType, + initEventQueue: jest.fn(), + flushEventQueue: jest.fn(), }), ) }