From 6e23821531959bf017bb8d241f0bfc7c76b0ed37 Mon Sep 17 00:00:00 2001 From: Luciano Gorza Date: Mon, 25 Sep 2023 10:10:45 -0300 Subject: [PATCH] Change port in route unit tests Signed-off-by: Luciano Gorza --- .../server/routes/updates/get-updates.test.ts | 2 +- .../server/routes/user-preferences/get-user-preferences.test.ts | 2 +- .../routes/user-preferences/update-user-preferences.test.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/wazuh-check-updates/server/routes/updates/get-updates.test.ts b/plugins/wazuh-check-updates/server/routes/updates/get-updates.test.ts index f6e2287f3a..9c2d6c8e37 100644 --- a/plugins/wazuh-check-updates/server/routes/updates/get-updates.test.ts +++ b/plugins/wazuh-check-updates/server/routes/updates/get-updates.test.ts @@ -9,7 +9,7 @@ import { getUpdatesRoute } from './get-updates'; import axios from 'axios'; const serverAddress = '127.0.0.1'; -const port = Math.floor(Math.random() * 60000) + 5000; +const port = 10002; //assign a different port in each unit test axios.defaults.baseURL = `http://${serverAddress}:${port}`; const mockedGetUpdates = getUpdates as jest.Mock; diff --git a/plugins/wazuh-check-updates/server/routes/user-preferences/get-user-preferences.test.ts b/plugins/wazuh-check-updates/server/routes/user-preferences/get-user-preferences.test.ts index b083d1bc70..c2d75354e5 100644 --- a/plugins/wazuh-check-updates/server/routes/user-preferences/get-user-preferences.test.ts +++ b/plugins/wazuh-check-updates/server/routes/user-preferences/get-user-preferences.test.ts @@ -8,7 +8,7 @@ import { getUserPreferences } from '../../services/user-preferences'; import { getUserPreferencesRoutes } from './get-user-preferences'; const serverAddress = '127.0.0.1'; -const port = Math.floor(Math.random() * 60000) + 5000; +const port = 10003; //assign a different port in each unit test axios.defaults.baseURL = `http://${serverAddress}:${port}`; const mockedGetUserPreferences = getUserPreferences as jest.Mock; diff --git a/plugins/wazuh-check-updates/server/routes/user-preferences/update-user-preferences.test.ts b/plugins/wazuh-check-updates/server/routes/user-preferences/update-user-preferences.test.ts index da3bbfeebf..abdc80e74a 100644 --- a/plugins/wazuh-check-updates/server/routes/user-preferences/update-user-preferences.test.ts +++ b/plugins/wazuh-check-updates/server/routes/user-preferences/update-user-preferences.test.ts @@ -8,7 +8,7 @@ import { updateUserPreferences } from '../../services/user-preferences'; import { updateUserPreferencesRoutes } from './update-user-preferences'; const serverAddress = '127.0.0.1'; -const port = Math.floor(Math.random() * 60000) + 5000; +const port = 10004; //assign a different port in each unit test axios.defaults.baseURL = `http://${serverAddress}:${port}`; const mockedUpdateUserPreferences = updateUserPreferences as jest.Mock;