Skip to content

Commit

Permalink
Fixed naming inconsistencies
Browse files Browse the repository at this point in the history
  • Loading branch information
adithyanotfound committed Oct 21, 2024
1 parent e85dff6 commit 1062a7a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
console.log('Welcome to the Talawa Admin setup! 🚀');
Expand Down Expand Up @@ -111,7 +111,7 @@ export async function main(): Promise<void> {
let endpoint = '';

while (!isConnected) {
endpoint = await askForTalawaWebsocketUrl();
endpoint = await askForTalawaWebSocketUrl();
const url = new URL(endpoint);
isConnected = await checkConnection(url.origin);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
});
Expand All @@ -15,7 +15,7 @@ describe('askForTalawaWebsocketUrl', () => {
endpoint: 'ws://example.com/graphql/',
});

const result = await askForTalawaWebsocketUrl();
const result = await askForTalawaWebSocketUrl();

expect(mockPrompt).toHaveBeenCalledWith([
{
Expand All @@ -35,7 +35,7 @@ describe('askForTalawaWebsocketUrl', () => {
endpoint: '',
});

const result = await askForTalawaWebsocketUrl();
const result = await askForTalawaWebSocketUrl();

expect(mockPrompt).toHaveBeenCalledWith([
{
Expand All @@ -54,15 +54,15 @@ 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 () => {
const mockPrompt = jest.spyOn(inquirer, 'prompt').mockResolvedValueOnce({
endpoint: '',
});

const result = await askForTalawaWebsocketUrl();
const result = await askForTalawaWebSocketUrl();

expect(mockPrompt).toHaveBeenCalledWith([
{
Expand All @@ -82,7 +82,7 @@ describe('askForTalawaWebsocketUrl', () => {
endpoint: '12345',
});

const result = await askForTalawaWebsocketUrl();
const result = await askForTalawaWebSocketUrl();

expect(mockPrompt).toHaveBeenCalledWith([
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function isValidWebSocketUrl(url: string): boolean {
}
}

export async function askForTalawaWebsocketUrl(): Promise<string> {
export async function askForTalawaWebSocketUrl(): Promise<string> {
const { endpoint } = await inquirer.prompt([
{
type: 'input',
Expand Down

0 comments on commit 1062a7a

Please sign in to comment.