diff --git a/Firestore/Swift/Tests/Integration/PipelineSubqueryTests.swift b/Firestore/Swift/Tests/Integration/PipelineSubqueryTests.swift index 3a5fc6be96f..181d7dd9cde 100644 --- a/Firestore/Swift/Tests/Integration/PipelineSubqueryTests.swift +++ b/Firestore/Swift/Tests/Integration/PipelineSubqueryTests.swift @@ -783,4 +783,22 @@ class PipelineSubqueryTests: FSTIntegrationTestCase { ) } } + + func testUnionWithSubqueryThrows() async throws { + let collRef = collectionRef() + let db = collRef.firestore + + do { + _ = try await db.pipeline() + .collection(collRef.path) + .union(with: Subcollection("subcollection")) + .execute() + XCTFail("Should throw error") + } catch { + XCTAssertTrue( + error.localizedDescription.contains("Union only supports combining root pipelines"), + error.localizedDescription + ) + } + } }