Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
test: readded mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
codyarose committed Jan 10, 2021
1 parent f6ec2e5 commit 70a1bc0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/__tests__/medications/Medications.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import thunk from 'redux-thunk'

import Medications from '../../medications/Medications'
import { TitleProvider } from '../../page-header/title/TitleContext'
import MedicationRepository from '../../shared/db/MedicationRepository'
import PatientRepository from '../../shared/db/PatientRepository'
import Medication from '../../shared/model/Medication'
import Patient from '../../shared/model/Patient'
import Permissions from '../../shared/model/Permissions'
import { RootState } from '../../shared/store'

Expand All @@ -27,6 +30,15 @@ const expectedMedication = ({

describe('Medications', () => {
const setup = (route: string, permissions: Permissions[] = []) => {
jest.resetAllMocks()
jest.spyOn(MedicationRepository, 'search').mockResolvedValue([])
jest
.spyOn(MedicationRepository, 'find')
.mockResolvedValue({ id: '1234', requestedOn: new Date().toISOString() } as Medication)
jest
.spyOn(PatientRepository, 'find')
.mockResolvedValue({ id: '12345', fullName: 'test test' } as Patient)

const store = mockStore({
title: 'test',
user: { permissions },
Expand Down

0 comments on commit 70a1bc0

Please sign in to comment.