From 6a9a9f1735096158551b32a09296937017260692 Mon Sep 17 00:00:00 2001 From: Pedro Ramos Date: Thu, 4 Apr 2024 21:07:06 +0200 Subject: [PATCH 1/2] Refactor tests for 'analytics' command --- test/helpers/index.ts | 5 ----- test/integration/config/analytics.test.ts | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/test/helpers/index.ts b/test/helpers/index.ts index 06d01cdc406..65589b69ecd 100644 --- a/test/helpers/index.ts +++ b/test/helpers/index.ts @@ -8,7 +8,6 @@ import rimraf from 'rimraf'; const ASYNCAPI_FILE_PATH = path.resolve(process.cwd(), 'specification.yaml'); const SERVER_DIRECTORY= path.join(__dirname, '../fixtures/dummyspec'); export const PROJECT_DIRECTORY_PATH = path.join(process.cwd(), 'test-project'); -export const ANALYTICS_CONFIG_FILE_PATH = path.resolve(process.cwd(), '.asyncapi-analytics'); let server: http.Server; @@ -87,10 +86,6 @@ export default class ContextTestingHelper { deleteDummyProjectDirectory(): void { rimraf.sync(PROJECT_DIRECTORY_PATH); } - - deleteAnalyticsConfigFile(): void { - unlinkSync(ANALYTICS_CONFIG_FILE_PATH); - } } export function fileCleanup(filepath: string) { diff --git a/test/integration/config/analytics.test.ts b/test/integration/config/analytics.test.ts index cc33362031e..b3ac49e4b40 100644 --- a/test/integration/config/analytics.test.ts +++ b/test/integration/config/analytics.test.ts @@ -1,11 +1,11 @@ import { expect, test } from '@oclif/test'; -import TestHelper from '../../helpers'; +import TestHelper, { fileCleanup } from '../../helpers'; const testHelper = new TestHelper(); describe('config:analytics', () => { afterEach(() => { - testHelper.deleteAnalyticsConfigFile(); + fileCleanup('.asyncapi-analytics'); }); describe('with disable flag', () => { From c221215f01e9252fdd25e9be85f1b90354fafe5e Mon Sep 17 00:00:00 2001 From: Pedro Ramos Date: Thu, 4 Apr 2024 21:15:50 +0200 Subject: [PATCH 2/2] Cleanup --- test/integration/config/analytics.test.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/integration/config/analytics.test.ts b/test/integration/config/analytics.test.ts index b3ac49e4b40..8f5ae75183d 100644 --- a/test/integration/config/analytics.test.ts +++ b/test/integration/config/analytics.test.ts @@ -1,7 +1,5 @@ import { expect, test } from '@oclif/test'; -import TestHelper, { fileCleanup } from '../../helpers'; - -const testHelper = new TestHelper(); +import { fileCleanup } from '../../helpers'; describe('config:analytics', () => { afterEach(() => {