From d0533c49870ed1f5013f641036ebb7f2dd91efa9 Mon Sep 17 00:00:00 2001 From: Michael Weiner <47571709+mike-weiner@users.noreply.github.com> Date: Sat, 13 Jan 2024 12:42:07 -0600 Subject: [PATCH] Reorganize Unit Test Files (#29) * re-structure tests directory * update npmignore with new tests directory --- .npmignore | 2 +- {commands/__tests__ => tests/commands}/config.test.js | 2 +- .../__tests__ => tests/commands/metadata}/catalong.test.js | 2 +- .../metadata/__tests__ => tests/commands/metadata}/mine.test.js | 2 +- .../__tests__ => tests/commands/metadata}/stations.test.js | 2 +- {commands/__tests__ => tests/commands}/status.test.js | 2 +- .../__tests__ => tests/commands/weather}/current.test.js | 2 +- .../__tests__ => tests/commands/weather}/historic.test.js | 2 +- {lib/__tests__ => tests/lib}/utils.test.js | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) rename {commands/__tests__ => tests/commands}/config.test.js (96%) rename {commands/metadata/__tests__ => tests/commands/metadata}/catalong.test.js (98%) rename {commands/metadata/__tests__ => tests/commands/metadata}/mine.test.js (98%) rename {commands/metadata/__tests__ => tests/commands/metadata}/stations.test.js (98%) rename {commands/__tests__ => tests/commands}/status.test.js (98%) rename {commands/weather/__tests__ => tests/commands/weather}/current.test.js (98%) rename {commands/weather/__tests__ => tests/commands/weather}/historic.test.js (99%) rename {lib/__tests__ => tests/lib}/utils.test.js (99%) diff --git a/.npmignore b/.npmignore index fbcec51..7032bd9 100644 --- a/.npmignore +++ b/.npmignore @@ -5,7 +5,7 @@ jest.config.js .jest/ coverage/ node_modules/ -**/__tests__ +tests/ # Ignore Github Repo Configuration .github/ diff --git a/commands/__tests__/config.test.js b/tests/commands/config.test.js similarity index 96% rename from commands/__tests__/config.test.js rename to tests/commands/config.test.js index 2ebeef4..40b84d8 100644 --- a/commands/__tests__/config.test.js +++ b/tests/commands/config.test.js @@ -9,7 +9,7 @@ jest.unstable_mockModule('ora', () => ({ }) })); -const { default: config } = await import('../config.js'); +const { default: config } = await import('../../commands/config.js'); describe('wlbot config', () => { diff --git a/commands/metadata/__tests__/catalong.test.js b/tests/commands/metadata/catalong.test.js similarity index 98% rename from commands/metadata/__tests__/catalong.test.js rename to tests/commands/metadata/catalong.test.js index bcbd162..c4bbe71 100644 --- a/commands/metadata/__tests__/catalong.test.js +++ b/tests/commands/metadata/catalong.test.js @@ -25,7 +25,7 @@ jest.unstable_mockModule('../../../lib/utils.js', () => { }; }); -const { default: catalog } = await import('../catalog.js'); +const { default: catalog } = await import('../../../commands/metadata/catalog.js'); const logSpy = jest.spyOn(console, "log").mockImplementation(() => { }); const dirSpy = jest.spyOn(console, "dir").mockImplementation(() => { }); diff --git a/commands/metadata/__tests__/mine.test.js b/tests/commands/metadata/mine.test.js similarity index 98% rename from commands/metadata/__tests__/mine.test.js rename to tests/commands/metadata/mine.test.js index 26c8c31..b9f9d99 100644 --- a/commands/metadata/__tests__/mine.test.js +++ b/tests/commands/metadata/mine.test.js @@ -25,7 +25,7 @@ jest.unstable_mockModule('../../../lib/utils.js', () => { }; }); -const { default: mine } = await import('../mine.js'); +const { default: mine } = await import('../../../commands/metadata/mine.js'); const logSpy = jest.spyOn(console, "log").mockImplementation(() => { }); const dirSpy = jest.spyOn(console, "dir").mockImplementation(() => { }); diff --git a/commands/metadata/__tests__/stations.test.js b/tests/commands/metadata/stations.test.js similarity index 98% rename from commands/metadata/__tests__/stations.test.js rename to tests/commands/metadata/stations.test.js index cc850a0..bf2ebb7 100644 --- a/commands/metadata/__tests__/stations.test.js +++ b/tests/commands/metadata/stations.test.js @@ -25,7 +25,7 @@ jest.unstable_mockModule('../../../lib/utils.js', () => { }; }); -const { default: stations } = await import('../stations.js'); +const { default: stations } = await import('../../../commands/metadata/stations.js'); const logSpy = jest.spyOn(console, "log").mockImplementation(() => { }); const dirSpy = jest.spyOn(console, "dir").mockImplementation(() => { }); diff --git a/commands/__tests__/status.test.js b/tests/commands/status.test.js similarity index 98% rename from commands/__tests__/status.test.js rename to tests/commands/status.test.js index b1fcfd6..3595827 100644 --- a/commands/__tests__/status.test.js +++ b/tests/commands/status.test.js @@ -9,7 +9,7 @@ jest.unstable_mockModule('axios', () => ({ const logSpy = jest.spyOn(console, "log").mockImplementation(() => { }); -const { default: status } = await import('../status.js'); +const { default: status } = await import('../../commands/status.js'); describe('wlbot config', () => { const mockSuccessfulApiCall = { diff --git a/commands/weather/__tests__/current.test.js b/tests/commands/weather/current.test.js similarity index 98% rename from commands/weather/__tests__/current.test.js rename to tests/commands/weather/current.test.js index 449c5ab..359b913 100644 --- a/commands/weather/__tests__/current.test.js +++ b/tests/commands/weather/current.test.js @@ -25,7 +25,7 @@ jest.unstable_mockModule('../../../lib/utils.js', () => { }; }); -const { default: current } = await import('../current.js'); +const { default: current } = await import('../../../commands/weather/current.js'); const logSpy = jest.spyOn(console, "log").mockImplementation(() => { }); const dirSpy = jest.spyOn(console, "dir").mockImplementation(() => { }); diff --git a/commands/weather/__tests__/historic.test.js b/tests/commands/weather/historic.test.js similarity index 99% rename from commands/weather/__tests__/historic.test.js rename to tests/commands/weather/historic.test.js index 2a669ad..27d4b82 100644 --- a/commands/weather/__tests__/historic.test.js +++ b/tests/commands/weather/historic.test.js @@ -27,7 +27,7 @@ jest.unstable_mockModule('../../../lib/utils.js', () => { }; }); -const { default: historic } = await import('../historic.js'); +const { default: historic } = await import('../../../commands/weather/historic.js'); const logSpy = jest.spyOn(console, "log").mockImplementation(() => { }); const dirSpy = jest.spyOn(console, "dir").mockImplementation(() => { }); diff --git a/lib/__tests__/utils.test.js b/tests/lib/utils.test.js similarity index 99% rename from lib/__tests__/utils.test.js rename to tests/lib/utils.test.js index 96cc17a..61488d3 100644 --- a/lib/__tests__/utils.test.js +++ b/tests/lib/utils.test.js @@ -1,4 +1,4 @@ -import { buildWeatherLinkApiUrl, checkForRequired, dateRangeIsValid } from '../utils.js'; +import { buildWeatherLinkApiUrl, checkForRequired, dateRangeIsValid } from '../../lib/utils.js'; describe('buildWeatherLinkApiUrl(...)', () => { describe('Correctly Builds WeatherLink API URL', () => {