@@ -54,6 +54,16 @@ class PublisherTests: XCTestCase {
5454 } , after: 0.05 , thenWait: 0.1 )
5555 }
5656
57+ func testReceivesCurrentValuesWhenSubscribing( ) throws {
58+ let expectation = self . expectation ( description: " Received current values " )
59+
60+ let expected : Array < Array < SQLiteRow > > = [ [ _person1. asArguments, _person2. asArguments] ]
61+ let publisher : AnyPublisher < Array < SQLiteRow > , Swift . Error > = database. publisher ( Person . getAll)
62+ let sink = self . sink ( for: publisher, expecting: expected, expectation: expectation)
63+ waitForExpectations ( timeout: 0.5 )
64+ sink. cancel ( )
65+ }
66+
5767 func testDeleteAsSQLiteRow( ) throws {
5868 let expectation = self . expectation ( description: " Received two notifications " )
5969
@@ -143,6 +153,7 @@ class PublisherTests: XCTestCase {
143153 static var allTests = [
144154 ( " testReceivesCompletionWithErrorGivenInvalidSQL " , testReceivesCompletionWithErrorGivenInvalidSQL) ,
145155 ( " testCancellingForeverCancelsSubscriptions " , testCancellingForeverCancelsSubscriptions) ,
156+ ( " testReceivesCurrentValuesWhenSubscribing " , testReceivesCurrentValuesWhenSubscribing) ,
146157 ( " testDeleteAsSQLiteRow " , testDeleteAsSQLiteRow) ,
147158 ( " testDelete " , testDelete) ,
148159 ( " testDeleteFirstWhere " , testDeleteFirstWhere) ,
0 commit comments