@@ -1830,22 +1830,17 @@ var _ = Describe("Patients Repository", func() {
18301830 })
18311831
18321832 Describe ("Add provider connection request" , func () {
1833- BeforeEach (func () {
1834- dataSources := patients.DataSources {{
1835- ProviderName : patients .DexcomDataSourceProviderName ,
1836- State : "pending" ,
1837- }}
1838- err := repo .UpdatePatientDataSources (context .Background (), * randomPatient .UserId , & dataSources )
1839- Expect (err ).ToNot (HaveOccurred ())
1840- })
1841-
18421833 It ("correctly adds multiple requests" , func () {
18431834 request := patients.ConnectionRequest {
18441835 ProviderName : patients .DexcomDataSourceProviderName ,
18451836 CreatedTime : time .Now ().Truncate (time .Millisecond ),
18461837 }
18471838
1848- err := repo .AddProviderConnectionRequest (context .Background (), randomPatient .ClinicId .Hex (), * randomPatient .UserId , request )
1839+ patientBefore , err := repo .Get (context .Background (),
1840+ randomPatient .ClinicId .Hex (), * randomPatient .UserId )
1841+ Expect (err ).ToNot (HaveOccurred ())
1842+
1843+ err = repo .AddProviderConnectionRequest (context .Background (), randomPatient .ClinicId .Hex (), * randomPatient .UserId , request )
18491844 Expect (err ).ToNot (HaveOccurred ())
18501845
18511846 err = repo .AddProviderConnectionRequest (context .Background (), randomPatient .ClinicId .Hex (), * randomPatient .UserId , request )
@@ -1863,6 +1858,8 @@ var _ = Describe("Patients Repository", func() {
18631858 Expect (dexcom [0 ].ProviderName ).To (BeComparableTo (request .ProviderName ))
18641859 Expect (dexcom [1 ].CreatedTime ).To (BeComparableTo (request .CreatedTime ))
18651860 Expect (dexcom [1 ].ProviderName ).To (BeComparableTo (request .ProviderName ))
1861+
1862+ Expect (patient .UpdatedTime ).To (BeTemporally (">" , patientBefore .UpdatedTime ))
18661863 })
18671864 })
18681865
0 commit comments