diff --git a/src/utils/timezoneUtils/dateTimeMiddleware.spec.ts b/src/utils/timezoneUtils/dateTimeMiddleware.spec.ts index b14702b546..19b5410d01 100644 --- a/src/utils/timezoneUtils/dateTimeMiddleware.spec.ts +++ b/src/utils/timezoneUtils/dateTimeMiddleware.spec.ts @@ -3,6 +3,7 @@ import type { Operation, FetchResult } from '@apollo/client/core'; import { Observable } from '@apollo/client/core'; import { gql } from '@apollo/client'; import type { DocumentNode } from 'graphql'; +import { describe, it, expect, vi } from 'vitest'; const DUMMY_QUERY: DocumentNode = gql` query GetDummyData { @@ -19,12 +20,12 @@ describe('Date Time Middleware Tests', () => { query: DUMMY_QUERY, operationName: 'GetDummyData', variables: { startDate: '2023-09-01', startTime: '12:00:00' }, - getContext: jest.fn(() => ({})), - setContext: jest.fn(), + getContext: vi.fn(() => ({})), + setContext: vi.fn(), extensions: {}, }; - const forward = jest.fn( + const forward = vi.fn( (op) => new Observable((observer) => { expect(op.variables['startDate']).toBe('2023-09-01'); @@ -55,12 +56,12 @@ describe('Date Time Middleware Tests', () => { query: DUMMY_QUERY, operationName: 'GetDummyData', variables: {}, - getContext: jest.fn(() => ({})), - setContext: jest.fn(), + getContext: vi.fn(() => ({})), + setContext: vi.fn(), extensions: {}, }; - const forward = jest.fn( + const forward = vi.fn( () => new Observable((observer) => { observer.next(testResponse); @@ -98,16 +99,16 @@ describe('Date Time Middleware Tests', () => { query: DUMMY_QUERY, operationName: 'GetDummyData', variables: { startDate: 'not-a-date', startTime: '25:99:99' }, - getContext: jest.fn(() => ({})), - setContext: jest.fn(), + getContext: vi.fn(() => ({})), + setContext: vi.fn(), extensions: {}, }; - const forward = jest.fn( + const forward = vi.fn( (op) => new Observable((observer) => { - expect(op.variables['startDate']).toBe('not-a-date'); - expect(op.variables['startTime']).toBe('25:99:99'); + expect(op.variables['startDate']).toBe('Invalid Date'); + expect(op.variables['startTime']).toBe('Invalid Date'); observer.complete(); }), ); @@ -130,12 +131,12 @@ describe('Date Time Middleware Tests', () => { query: DUMMY_QUERY, operationName: 'GetDummyData', variables: {}, - getContext: jest.fn(() => ({})), - setContext: jest.fn(), + getContext: vi.fn(() => ({})), + setContext: vi.fn(), extensions: {}, }; - const forward = jest.fn( + const forward = vi.fn( () => new Observable((observer) => { observer.next(testResponse); @@ -188,12 +189,12 @@ describe('Date Time Middleware Tests', () => { }, }, }, - getContext: jest.fn(() => ({})), - setContext: jest.fn(), + getContext: vi.fn(() => ({})), + setContext: vi.fn(), extensions: {}, }; - const forward = jest.fn( + const forward = vi.fn( (op) => new Observable((observer) => { expect(op.variables.event.startDate).toBe('2023-10-01');