diff --git a/src/setup/checkConnection/checkConnection.test.ts b/src/setup/checkConnection/checkConnection.spec.ts similarity index 84% rename from src/setup/checkConnection/checkConnection.test.ts rename to src/setup/checkConnection/checkConnection.spec.ts index c6f5251bdf..724f1a49dd 100644 --- a/src/setup/checkConnection/checkConnection.test.ts +++ b/src/setup/checkConnection/checkConnection.spec.ts @@ -1,8 +1,8 @@ import { checkConnection } from './checkConnection'; +import { vi, describe, beforeEach, it, expect } from 'vitest'; +vi.mock('node-fetch'); -jest.mock('node-fetch'); - -global.fetch = jest.fn((url) => { +global.fetch = vi.fn((url) => { if (url === 'http://example.com/graphql/') { const responseInit: ResponseInit = { status: 200, @@ -22,11 +22,11 @@ global.fetch = jest.fn((url) => { describe('checkConnection', () => { beforeEach(() => { - jest.clearAllMocks(); + vi.clearAllMocks(); }); test('should return true and log success message if the connection is successful', async () => { - jest.spyOn(console, 'log').mockImplementation((string) => string); + vi.spyOn(console, 'log').mockImplementation((string) => string); const result = await checkConnection('http://example.com/graphql/'); expect(result).toBe(true); @@ -39,7 +39,7 @@ describe('checkConnection', () => { }); it('should return false and log error message if the connection fails', async () => { - jest.spyOn(console, 'log').mockImplementation((string) => string); + vi.spyOn(console, 'log').mockImplementation((string) => string); const result = await checkConnection( 'http://example_not_working.com/graphql/', );