Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(refactor) Set global testTimeout in Jest config #1573

Merged
merged 3 commits into from
Jan 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -39,4 +39,5 @@ module.exports = {
testEnvironmentOptions: {
url: 'http://localhost/',
},
testTimeout: 20000,
};
Original file line number Diff line number Diff line change
@@ -14,8 +14,6 @@ const mockUseAllergicReactions = useAllergicReactions as jest.Mock;
const mockShowSnackbar = showSnackbar as jest.Mock;
const mockShowToast = showToast as jest.Mock;

jest.setTimeout(15000);

jest.mock('./allergy-form.resource', () => {
const originalModule = jest.requireActual('./allergy-form.resource');

Original file line number Diff line number Diff line change
@@ -8,8 +8,6 @@ import { mockPatient } from 'tools';
import { useVisitAttributeType } from '../hooks/useVisitAttributeType';
import StartVisitForm from './visit-form.component';

jest.setTimeout(10000);

const mockCloseWorkspace = jest.fn();
const mockPromptBeforeClosing = jest.fn();

Original file line number Diff line number Diff line change
@@ -6,8 +6,6 @@ import { renderWithSwr } from 'tools';
import { mockEncounters2 } from '__mocks__';
import EncountersTable from './encounters-table.component';

jest.setTimeout(10000);

const testProps = {
showAllEncounters: true,
encounters: mockEncounters2,
Original file line number Diff line number Diff line change
@@ -6,8 +6,6 @@ import { mockPatient, renderWithSwr } from 'tools';
import { mockEncounters } from '__mocks__';
import VisitsTable from './visits-table.component';

jest.setTimeout(10000);

const testProps = {
patientUuid: mockPatient.id,
showAllEncounters: true,
Original file line number Diff line number Diff line change
@@ -10,8 +10,6 @@ const testProps = {
patientUuid: mockPatient.id,
};

jest.setTimeout(5000);

const mockOpenmrsFetch = openmrsFetch as jest.Mock;
const mockUseConfig = useConfig as jest.Mock;
const mockGetConfig = getConfig as jest.Mock;
2 changes: 0 additions & 2 deletions packages/esm-patient-chart-app/translations/am.json
Original file line number Diff line number Diff line change
@@ -102,8 +102,6 @@
"noDiagnosesFound": "No diagnoses found",
"noEncountersFound": "No encounters found",
"noEncountersToDisplay": "No encounters to display",
"noMedicationsFound": "No medications found",
"noNotesFound": "No notes found",
"noObservationsFound": "No observations found",
"notes": "Notes",
"Offline Actions dashboard": "Offline Actions dashboard",
2 changes: 0 additions & 2 deletions packages/esm-patient-chart-app/translations/ar.json
Original file line number Diff line number Diff line change
@@ -102,8 +102,6 @@
"noDiagnosesFound": "لم يتم العثور على تشخيصات",
"noEncountersFound": "لم يتم العثور على لقاءات",
"noEncountersToDisplay": "لا يوجد لقاءات لعرضها",
"noMedicationsFound": "لم يتم العثور على أدوية",
"noNotesFound": "لم يتم العثور على ملاحظات",
"noObservationsFound": "لم يتم العثور على ملاحظات",
"notes": "ملاحظات",
"Offline Actions dashboard": "لوحة الإجراءات دون اتصال",
2 changes: 0 additions & 2 deletions packages/esm-patient-chart-app/translations/en.json
Original file line number Diff line number Diff line change
@@ -102,8 +102,6 @@
"noDiagnosesFound": "No diagnoses found",
"noEncountersFound": "No encounters found",
"noEncountersToDisplay": "No encounters to display",
"noMedicationsFound": "No medications found",
"noNotesFound": "No notes found",
"noObservationsFound": "No observations found",
"notes": "Notes",
"Offline Actions dashboard": "Offline Actions dashboard",
2 changes: 0 additions & 2 deletions packages/esm-patient-chart-app/translations/es.json
Original file line number Diff line number Diff line change
@@ -102,8 +102,6 @@
"noDiagnosesFound": "No se encontraron diagnósticos",
"noEncountersFound": "No se encontraron encuentros",
"noEncountersToDisplay": "No hay encuentros para mostrar",
"noMedicationsFound": "No se encontraron medicamentos",
"noNotesFound": "No se encontraron notas",
"noObservationsFound": "No se encontraron observaciones",
"notes": "Notas",
"Offline Actions dashboard": "Panel de Acciones sin Conexión",
2 changes: 0 additions & 2 deletions packages/esm-patient-chart-app/translations/fr.json
Original file line number Diff line number Diff line change
@@ -102,8 +102,6 @@
"noDiagnosesFound": "Aucun diagnostic trouvé",
"noEncountersFound": "Aucune rencontre trouvée",
"noEncountersToDisplay": "Aucune rencontre à afficher",
"noMedicationsFound": "Aucun médicament trouvé",
"noNotesFound": "Aucune note trouvée",
"noObservationsFound": "Aucune observation trouvée",
"notes": "Notes",
"Offline Actions dashboard": "Tableau de bord des actions hors ligne",
2 changes: 0 additions & 2 deletions packages/esm-patient-chart-app/translations/he.json
Original file line number Diff line number Diff line change
@@ -102,8 +102,6 @@
"noDiagnosesFound": "לא נמצאו אבחנות",
"noEncountersFound": "לא נמצאו ביקורים",
"noEncountersToDisplay": "אין ביקורים להצגה",
"noMedicationsFound": "לא נמצאו תרופות",
"noNotesFound": "לא נמצאו הערות",
"noObservationsFound": "לא נמצאו תצפיות",
"notes": "הערות",
"Offline Actions dashboard": "לוח הפעולות לא מקוונות",
2 changes: 0 additions & 2 deletions packages/esm-patient-chart-app/translations/km.json
Original file line number Diff line number Diff line change
@@ -102,8 +102,6 @@
"noDiagnosesFound": "រកមិនឃើញរោគវិនិច្ឆ័យទេ",
"noEncountersFound": "រកមិនឃើញការជួបគ្នាទេ",
"noEncountersToDisplay": "ពុំមានព័ត៌មានការពិនិត្យបង្ហាញទេ",
"noMedicationsFound": "រកមិនឃើញឱសថព្យាបាលទេ",
"noNotesFound": "រកមិនឃើញកំណត់ចំណាំទេ",
"noObservationsFound": "រកមិនឃើញការសង្កេតទេ",
"notes": "រកមិនឃើញការកត់ចំណាំទេ",
"Offline Actions dashboard": "ផ្ទាំងគ្រប់គ្រងសកម្មភាពក្រៅបណ្តាញ",
Original file line number Diff line number Diff line change
@@ -8,8 +8,6 @@ import { getByTextWithMarkup, mockPatient } from 'tools';
import { createCondition, useConditionsSearch } from './conditions.resource';
import ConditionsForm from './conditions-form.component';

jest.setTimeout(10000);

jest.mock('zod', () => {
const originalModule = jest.requireActual('zod');
const mockedZod = {
Original file line number Diff line number Diff line change
@@ -8,8 +8,6 @@ import { mockConditions, mockFhirConditionsResponse } from '__mocks__';
import { mockPatient, renderWithSwr, waitForLoadingToFinish } from 'tools';
import ConditionsOverview from './conditions-overview.component';

jest.setTimeout(15000);

const testProps = {
patientUuid: mockPatient.id,
};
Original file line number Diff line number Diff line change
@@ -7,8 +7,6 @@ import { mockPatientFlags } from '__mocks__';
import { usePatientFlags } from './hooks/usePatientFlags';
import FlagsHighlightBar from './flags-highlight-bar.component';

jest.setTimeout(5000);

const mockedUsePatientFlags = usePatientFlags as jest.Mock;

jest.mock('@openmrs/esm-patient-common-lib', () => {
Original file line number Diff line number Diff line change
@@ -8,8 +8,6 @@ import { age, useConfig, useLayoutType, usePatient, useSession } from '@openmrs/
import { type PostDataPrepFunction, useOrderBasket } from '@openmrs/esm-patient-common-lib';
import { createEmptyLabOrder } from './lab-order';

jest.setTimeout(10000);

const mockUseConfig = useConfig as jest.Mock;
const mockUseSession = useSession as jest.Mock;
const mockUsePatient = usePatient as jest.Mock;
Original file line number Diff line number Diff line change
@@ -7,8 +7,6 @@ import { mockPatient, patientChartBasePath, renderWithSwr } from 'tools';
import NotesOverview from './notes-overview.component';
import { useVisitNotes } from './visit-notes.resource';

jest.setTimeout(20000);

const testProps = {
basePath: patientChartBasePath,
patient: mockPatient,
Original file line number Diff line number Diff line change
@@ -14,8 +14,6 @@ import {
import { mockPatient, getByTextWithMarkup } from 'tools';
import VisitNotesForm from './visit-notes-form.component';

jest.setTimeout(10000);

const testProps = {
patientUuid: mockPatient.id,
closeWorkspace: jest.fn(),
Original file line number Diff line number Diff line change
@@ -7,8 +7,6 @@ import { mockEnrolledProgramsResponse } from '__mocks__';
import { mockPatient, renderWithSwr, waitForLoadingToFinish } from 'tools';
import ProgramsDetailedSummary from './programs-detailed-summary.component';

jest.setTimeout(20000);

const mockOpenmrsFetch = openmrsFetch as jest.Mock;

jest.mock('@openmrs/esm-framework', () => {
Original file line number Diff line number Diff line change
@@ -9,8 +9,6 @@ import { createProgramEnrollment, updateProgramEnrollment } from './programs.res
import { mockPatient } from 'tools';
import ProgramsForm from './programs-form.component';

jest.setTimeout(20000);

const testProps = {
closeWorkspace: jest.fn(),
patientUuid: mockPatient.id,
Original file line number Diff line number Diff line change
@@ -8,8 +8,6 @@ import { mockEnrolledProgramsResponse } from '__mocks__';
import { mockPatient, renderWithSwr, waitForLoadingToFinish } from 'tools';
import ProgramsOverview from './programs-overview.component';

jest.setTimeout(5000);

const mockOpenmrsFetch = openmrsFetch as jest.Mock;
const mockUsePagination = usePagination as jest.Mock;