File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Tests/ExportersTests/PersistenceExporter/Export Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -138,6 +138,7 @@ class DataExportWorkerTests: XCTestCase {
138138
139139 func testWhenBatchFails_thenIntervalIncreases( ) {
140140 let delayChangeExpectation = expectation ( description: " Export delay is increased " )
141+
141142 let mockDelay = MockDelay { command in
142143 if case . increase = command {
143144 delayChangeExpectation. fulfill ( )
@@ -146,11 +147,20 @@ class DataExportWorkerTests: XCTestCase {
146147 }
147148 }
148149
149- let exportExpectation = self . expectation ( description: " value exported " )
150-
150+ let exportExpectation = expectation ( description: " value exported " )
151+
152+ // The onExport closure is called more than once as part of test execution
153+ // It does not seem to be called the same number of times on each test run.
154+ // Setting `assertForOverFulfill` to `false` works around the XCTestExpectation
155+ // error that fails the test.
156+ // "API violation - multiple calls made to -[XCTestExpectation fulfill] for value exported."
157+ exportExpectation. assertForOverFulfill = false
158+
151159 var mockDataExporter = DataExporterMock ( exportStatus: . mockWith( needsRetry: true ) )
152-
153- mockDataExporter. onExport = { data in exportExpectation. fulfill ( ) }
160+
161+ mockDataExporter. onExport = { data in
162+ exportExpectation. fulfill ( )
163+ }
154164
155165 // When
156166 let fileReader = FileReaderMock ( )
You can’t perform that action at this time.
0 commit comments