From 1062a7abbc11ed1d88c286e53fa53215416403bd Mon Sep 17 00:00:00 2001 From: adithya Date: Mon, 21 Oct 2024 23:20:09 +0530 Subject: [PATCH] Fixed naming inconsistencies --- setup.ts | 4 ++-- .../askForTalawaWebSocketUrl.test.ts | 14 +++++++------- .../askForTalawaWebSocketUrl.ts | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/setup.ts b/setup.ts index c3a0ef1c5c..21951aa954 100644 --- a/setup.ts +++ b/setup.ts @@ -6,7 +6,7 @@ import { askForTalawaApiUrl } from './src/setup/askForTalawaApiUrl/askForTalawaA import { checkEnvFile } from './src/setup/checkEnvFile/checkEnvFile'; import { validateRecaptcha } from './src/setup/validateRecaptcha/validateRecaptcha'; import { askForCustomPort } from './src/setup/askForCustomPort/askForCustomPort'; -import { askForTalawaWebsocketUrl } from './src/setup/askForTalawaWebSocketUrl/askForTalawaWebSocketUrl'; +import { askForTalawaWebSocketUrl } from './src/setup/askForTalawaWebSocketUrl/askForTalawaWebSocketUrl'; export async function main(): Promise { console.log('Welcome to the Talawa Admin setup! 🚀'); @@ -111,7 +111,7 @@ export async function main(): Promise { let endpoint = ''; while (!isConnected) { - endpoint = await askForTalawaWebsocketUrl(); + endpoint = await askForTalawaWebSocketUrl(); const url = new URL(endpoint); isConnected = await checkConnection(url.origin); } diff --git a/src/setup/askForTalawaWebSocketUrl/askForTalawaWebSocketUrl.test.ts b/src/setup/askForTalawaWebSocketUrl/askForTalawaWebSocketUrl.test.ts index e91cbab03a..5677e4d07a 100644 --- a/src/setup/askForTalawaWebSocketUrl/askForTalawaWebSocketUrl.test.ts +++ b/src/setup/askForTalawaWebSocketUrl/askForTalawaWebSocketUrl.test.ts @@ -1,11 +1,11 @@ import inquirer from 'inquirer'; -import { askForTalawaWebsocketUrl } from './askForTalawaWebSocketUrl'; +import { askForTalawaWebSocketUrl } from './askForTalawaWebSocketUrl'; jest.mock('inquirer', () => ({ prompt: jest.fn(), })); -describe('askForTalawaWebsocketUrl', () => { +describe('askForTalawaWebSocketUrl', () => { beforeEach(() => { jest.clearAllMocks(); }); @@ -15,7 +15,7 @@ describe('askForTalawaWebsocketUrl', () => { endpoint: 'ws://example.com/graphql/', }); - const result = await askForTalawaWebsocketUrl(); + const result = await askForTalawaWebSocketUrl(); expect(mockPrompt).toHaveBeenCalledWith([ { @@ -35,7 +35,7 @@ describe('askForTalawaWebsocketUrl', () => { endpoint: '', }); - const result = await askForTalawaWebsocketUrl(); + const result = await askForTalawaWebSocketUrl(); expect(mockPrompt).toHaveBeenCalledWith([ { @@ -54,7 +54,7 @@ describe('askForTalawaWebsocketUrl', () => { const mockError = new Error('Prompt failed'); jest.spyOn(inquirer, 'prompt').mockRejectedValueOnce(mockError); - await expect(askForTalawaWebsocketUrl()).rejects.toThrow('Prompt failed'); + await expect(askForTalawaWebSocketUrl()).rejects.toThrow('Prompt failed'); }); test('should handle empty user input and use the default value', async () => { @@ -62,7 +62,7 @@ describe('askForTalawaWebsocketUrl', () => { endpoint: '', }); - const result = await askForTalawaWebsocketUrl(); + const result = await askForTalawaWebSocketUrl(); expect(mockPrompt).toHaveBeenCalledWith([ { @@ -82,7 +82,7 @@ describe('askForTalawaWebsocketUrl', () => { endpoint: '12345', }); - const result = await askForTalawaWebsocketUrl(); + const result = await askForTalawaWebSocketUrl(); expect(mockPrompt).toHaveBeenCalledWith([ { diff --git a/src/setup/askForTalawaWebSocketUrl/askForTalawaWebSocketUrl.ts b/src/setup/askForTalawaWebSocketUrl/askForTalawaWebSocketUrl.ts index ef2b853eaf..ae9d657105 100644 --- a/src/setup/askForTalawaWebSocketUrl/askForTalawaWebSocketUrl.ts +++ b/src/setup/askForTalawaWebSocketUrl/askForTalawaWebSocketUrl.ts @@ -9,7 +9,7 @@ function isValidWebSocketUrl(url: string): boolean { } } -export async function askForTalawaWebsocketUrl(): Promise { +export async function askForTalawaWebSocketUrl(): Promise { const { endpoint } = await inquirer.prompt([ { type: 'input',