diff --git a/packages/hawtio/src/plugins/connect/init.test.ts b/packages/hawtio/src/plugins/connect/init.test.ts index ac9bea6f..ac67908c 100644 --- a/packages/hawtio/src/plugins/connect/init.test.ts +++ b/packages/hawtio/src/plugins/connect/init.test.ts @@ -1,8 +1,8 @@ +import { jolokiaService } from '@hawtiosrc/plugins/shared/jolokia-service' import fetchMock from 'jest-fetch-mock' -import { connectService } from '@hawtiosrc/plugins/shared/connect-service' import { isActive } from './init' -jest.mock('@hawtiosrc/plugins/shared/connect-service') +jest.mock('@hawtiosrc/plugins/shared/jolokia-service') describe('isActive', () => { beforeEach(() => { @@ -16,16 +16,16 @@ describe('isActive', () => { await expect(isActive()).resolves.toEqual(false) }) - test('/proxy/enabled returns not false & connection name is not set', async () => { + test('/proxy/enabled returns not false & jolokia url is null', async () => { fetchMock.mockResponse('true') - connectService.getCurrentConnectionName = jest.fn(() => null) + jolokiaService.getJolokiaUrl = jest.fn(async () => null) await expect(isActive()).resolves.toEqual(true) }) - test('/proxy/enabled returns not false & connection name is set', async () => { + test('/proxy/enabled returns not false & jolokia url is not null', async () => { fetchMock.mockResponse('') - connectService.getCurrentConnectionName = jest.fn(() => 'test-connection') + jolokiaService.getJolokiaUrl = jest.fn(async () => 'test-url') await expect(isActive()).resolves.toEqual(false) }) diff --git a/packages/hawtio/src/plugins/connect/init.ts b/packages/hawtio/src/plugins/connect/init.ts index fb6ca483..1fc7d8d3 100644 --- a/packages/hawtio/src/plugins/connect/init.ts +++ b/packages/hawtio/src/plugins/connect/init.ts @@ -1,4 +1,4 @@ -import { connectService } from '@hawtiosrc/plugins/shared/connect-service' +import { jolokiaService } from '@hawtiosrc/plugins/shared' import { log, PATH_PROXY_ENABLED } from './globals' export async function isActive(): Promise { @@ -7,7 +7,7 @@ export async function isActive(): Promise { return false } - return connectService.getCurrentConnectionName() === null + return (await jolokiaService.getJolokiaUrl()) === null } async function isProxyEnabled(): Promise {