Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
2ea0796
Refactor SelectionSet equality to recover type data
calvincestari Sep 24, 2025
bfeb4c4
Adds equality tests
calvincestari Sep 24, 2025
8a53f79
Adds another test for type cast edge case
calvincestari Sep 24, 2025
d417bee
Fix incorrect DataDict test key names
calvincestari Sep 25, 2025
57526e6
Refactor type casting
calvincestari Sep 25, 2025
469ef00
Fix for nullable objects being null in equality checks
calvincestari Sep 27, 2025
7ae6874
Add integration test
calvincestari Sep 27, 2025
f28dff6
Refactor scalar casting logic for nullable object types
calvincestari Sep 29, 2025
cc8a2de
Refactor scalar casting logic for lists
calvincestari Sep 29, 2025
df986c5
Fix and add tests
calvincestari Sep 29, 2025
893a4f5
Remove test mock infrastructure hash and equality implementations
calvincestari Sep 29, 2025
0974a19
debugging
calvincestari Oct 2, 2025
26e9a2a
debugging
calvincestari Oct 2, 2025
2997746
debugging
calvincestari Oct 2, 2025
8d22e46
debugging
calvincestari Oct 2, 2025
3041d77
debugging
calvincestari Oct 3, 2025
bb8db91
debugging
calvincestari Oct 3, 2025
3badf52
debugging
calvincestari Oct 3, 2025
494f9c8
debugging
calvincestari Oct 3, 2025
5aa2576
debugging
calvincestari Oct 3, 2025
7bea696
Revert "debugging"
calvincestari Oct 3, 2025
206689a
debugging
calvincestari Oct 3, 2025
ec8b168
Revert "debugging"
calvincestari Oct 3, 2025
fef4e3d
debugging
calvincestari Oct 3, 2025
df1ac1e
debugging
calvincestari Oct 3, 2025
b7e2b10
debugging
calvincestari Oct 3, 2025
a99e646
Revert "debugging"
calvincestari Oct 3, 2025
3e6f98f
debugging
calvincestari Oct 3, 2025
eceb242
debugging
calvincestari Oct 3, 2025
a798963
debugging
calvincestari Oct 3, 2025
42ed353
Revert "debugging"
calvincestari Oct 3, 2025
9876b04
Revert "debugging"
calvincestari Oct 3, 2025
317fc49
Adds new test with failing CI model
calvincestari Oct 6, 2025
8cef512
more debugging
calvincestari Oct 6, 2025
05140b8
debugging
calvincestari Oct 6, 2025
ec6ca05
debugging
calvincestari Oct 7, 2025
e6e63b3
debugging
calvincestari Oct 7, 2025
a3fa5e6
debugging
calvincestari Oct 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/build-and-run-unit-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ runs:
- name: Build and Test
shell: bash
run: |
xcodebuild clean test -resultBundlePath TestResults/ResultBundle.xcresult -derivedDataPath DerivedData -workspace "ApolloDev.xcworkspace" -scheme "${{ inputs.scheme }}" -destination "${{ inputs.destination }}" -testPlan "${{ inputs.test-plan }}" | xcbeautify
xcodebuild clean test -resultBundlePath TestResults/ResultBundle.xcresult -derivedDataPath DerivedData -workspace "ApolloDev.xcworkspace" -scheme "${{ inputs.scheme }}" -destination "${{ inputs.destination }}" -testPlan "${{ inputs.test-plan }}" -verbose -parallel-testing-enabled NO
8 changes: 0 additions & 8 deletions Tests/ApolloInternalTestHelpers/MockOperation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,6 @@ open class AbstractMockSelectionSet<F, S: SchemaMetadata>: RootSelectionSet, Has
public subscript<T: MockSelectionSet>(dynamicMember key: String) -> T? {
__data[key]
}

public static func == (lhs: MockSelectionSet, rhs: MockSelectionSet) -> Bool {
lhs.__data == rhs.__data
}

public func hash(into hasher: inout Hasher) {
hasher.combine(__data)
}
}

public typealias MockSelectionSet = AbstractMockSelectionSet<NoFragments, MockSchemaMetadata>
Expand Down
43 changes: 43 additions & 0 deletions Tests/ApolloPaginationTests/BidirectionalPaginationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,28 @@ final class BidirectionalPaginationTests: XCTestCase, CacheDependentTesting {

try XCTAssertSuccessResult(result) { output in
// Assert first page is unchanged
let first = try? results.first?.get().initialPage
let last = try? results.last?.get().initialPage
let _ = first?.data?.hero.friendsConnection == last?.data?.hero.friendsConnection
print("""
\(#function) - equality
equal: \(first == last)
data equal: \(first?.data == last?.data)
data.hero equal: \(first?.data?.hero == last?.data?.hero)
data.hero.__typename equal: \(first?.data?.hero.__typename == last?.data?.hero.__typename)
data.hero.id equal: \(first?.data?.hero.id == last?.data?.hero.id)
data.hero.name equal: \(first?.data?.hero.name == last?.data?.hero.name)
data.hero.friendsConnection equal: \(first?.data?.hero.friendsConnection == last?.data?.hero.friendsConnection)
hashes - lhs:\(first?.data?.hero.friendsConnection.hashValue) rhs:\(last?.data?.hero.friendsConnection.hashValue)
data.hero.friendsConnection.__data equal: \(first?.data?.hero.friendsConnection.__data == last?.data?.hero.friendsConnection.__data)
data.hero.friendsConnection.__data._data equal: \(first?.data?.hero.friendsConnection.__data._data == last?.data?.hero.friendsConnection.__data._data)
data.hero.friendsConnection.__data._fulfilledFragments equal: \(first?.data?.hero.friendsConnection.__data._fulfilledFragments == last?.data?.hero.friendsConnection.__data._fulfilledFragments)
data.hero.friendsConnection.__data._deferredFragments equal: \(first?.data?.hero.friendsConnection.__data._deferredFragments == last?.data?.hero.friendsConnection.__data._deferredFragments)
data.hero.friendsConnection.__typename equal: \(first?.data?.hero.friendsConnection.__typename == last?.data?.hero.friendsConnection.__typename)
data.hero.friendsConnection.totalCount equal: \(first?.data?.hero.friendsConnection.totalCount == last?.data?.hero.friendsConnection.totalCount)
data.hero.friendsConnection.friends equal: \(first?.data?.hero.friendsConnection.friends == last?.data?.hero.friendsConnection.friends)
data.hero.friendsConnection.pageInfo equal: \(first?.data?.hero.friendsConnection.pageInfo == last?.data?.hero.friendsConnection.pageInfo)
""")
XCTAssertEqual(try? results.first?.get().initialPage, try? results.last?.get().initialPage)

XCTAssertFalse(output.nextPages.isEmpty)
Expand Down Expand Up @@ -242,6 +264,27 @@ final class BidirectionalPaginationTests: XCTestCase, CacheDependentTesting {

try XCTAssertSuccessResult(result) { output in
// Assert first page is unchanged
let first = try? results.first?.get().initialPage
let last = try? results.last?.get().initialPage
print("""
\(#function) - equality
equal: \(first == last)
data equal: \(first?.data == last?.data)
data.hero equal: \(first?.data?.hero == last?.data?.hero)
data.hero.__typename equal: \(first?.data?.hero.__typename == last?.data?.hero.__typename)
data.hero.id equal: \(first?.data?.hero.id == last?.data?.hero.id)
data.hero.name equal: \(first?.data?.hero.name == last?.data?.hero.name)
data.hero.friendsConnection equal: \(first?.data?.hero.friendsConnection == last?.data?.hero.friendsConnection)
hashes - lhs:\(first?.data?.hero.friendsConnection.hashValue) rhs:\(last?.data?.hero.friendsConnection.hashValue)
data.hero.friendsConnection.__data equal: \(first?.data?.hero.friendsConnection.__data == last?.data?.hero.friendsConnection.__data)
data.hero.friendsConnection.__data._data equal: \(first?.data?.hero.friendsConnection.__data._data == last?.data?.hero.friendsConnection.__data._data)
data.hero.friendsConnection.__data._fulfilledFragments equal: \(first?.data?.hero.friendsConnection.__data._fulfilledFragments == last?.data?.hero.friendsConnection.__data._fulfilledFragments)
data.hero.friendsConnection.__data._deferredFragments equal: \(first?.data?.hero.friendsConnection.__data._deferredFragments == last?.data?.hero.friendsConnection.__data._deferredFragments)
data.hero.friendsConnection.__typename equal: \(first?.data?.hero.friendsConnection.__typename == last?.data?.hero.friendsConnection.__typename)
data.hero.friendsConnection.totalCount equal: \(first?.data?.hero.friendsConnection.totalCount == last?.data?.hero.friendsConnection.totalCount)
data.hero.friendsConnection.friends equal: \(first?.data?.hero.friendsConnection.friends == last?.data?.hero.friendsConnection.friends)
data.hero.friendsConnection.pageInfo equal: \(first?.data?.hero.friendsConnection.pageInfo == last?.data?.hero.friendsConnection.pageInfo)
""")
XCTAssertEqual(try? results.first?.get().initialPage, try? results.last?.get().initialPage)

XCTAssertFalse(output.nextPages.isEmpty)
Expand Down
42 changes: 42 additions & 0 deletions Tests/ApolloPaginationTests/ForwardPaginationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,27 @@ final class ForwardPaginationTests: XCTestCase, CacheDependentTesting {

try XCTAssertSuccessResult(result) { output in
// Assert first page is unchanged
let first = try? results.first?.get().initialPage
let last = try? results.last?.get().initialPage
print("""
\(#function) - equality
equal: \(first == last)
data equal: \(first?.data == last?.data)
data.hero equal: \(first?.data?.hero == last?.data?.hero)
data.hero.__typename equal: \(first?.data?.hero.__typename == last?.data?.hero.__typename)
data.hero.id equal: \(first?.data?.hero.id == last?.data?.hero.id)
data.hero.name equal: \(first?.data?.hero.name == last?.data?.hero.name)
data.hero.friendsConnection equal: \(first?.data?.hero.friendsConnection == last?.data?.hero.friendsConnection)
hashes - lhs:\(first?.data?.hero.friendsConnection.hashValue) rhs:\(last?.data?.hero.friendsConnection.hashValue)
data.hero.friendsConnection.__data equal: \(first?.data?.hero.friendsConnection.__data == last?.data?.hero.friendsConnection.__data)
data.hero.friendsConnection.__data._data equal: \(first?.data?.hero.friendsConnection.__data._data == last?.data?.hero.friendsConnection.__data._data)
data.hero.friendsConnection.__data._fulfilledFragments equal: \(first?.data?.hero.friendsConnection.__data._fulfilledFragments == last?.data?.hero.friendsConnection.__data._fulfilledFragments)
data.hero.friendsConnection.__data._deferredFragments equal: \(first?.data?.hero.friendsConnection.__data._deferredFragments == last?.data?.hero.friendsConnection.__data._deferredFragments)
data.hero.friendsConnection.__typename equal: \(first?.data?.hero.friendsConnection.__typename == last?.data?.hero.friendsConnection.__typename)
data.hero.friendsConnection.totalCount equal: \(first?.data?.hero.friendsConnection.totalCount == last?.data?.hero.friendsConnection.totalCount)
data.hero.friendsConnection.friends equal: \(first?.data?.hero.friendsConnection.friends == last?.data?.hero.friendsConnection.friends)
data.hero.friendsConnection.pageInfo equal: \(first?.data?.hero.friendsConnection.pageInfo == last?.data?.hero.friendsConnection.pageInfo)
""")
XCTAssertEqual(try? results.first?.get().initialPage, try? results.last?.get().initialPage)

XCTAssertFalse(output.nextPages.isEmpty)
Expand Down Expand Up @@ -204,6 +225,27 @@ final class ForwardPaginationTests: XCTestCase, CacheDependentTesting {
let newResult = try await XCTUnwrapping(await pager.currentValue)
try XCTAssertSuccessResult(newResult) { output in
// Assert first page is unchanged
let first = try? result.get().initialPage
let last = try? newResult.get().initialPage
print("""
\(#function) - equality
equal: \(first == last)
data equal: \(first?.data == last?.data)
data.hero equal: \(first?.data?.hero == last?.data?.hero)
data.hero.__typename equal: \(first?.data?.hero.__typename == last?.data?.hero.__typename)
data.hero.id equal: \(first?.data?.hero.id == last?.data?.hero.id)
data.hero.name equal: \(first?.data?.hero.name == last?.data?.hero.name)
data.hero.friendsConnection equal: \(first?.data?.hero.friendsConnection == last?.data?.hero.friendsConnection)
hashes - lhs:\(first?.data?.hero.friendsConnection.hashValue) rhs:\(last?.data?.hero.friendsConnection.hashValue)
data.hero.friendsConnection.__data equal: \(first?.data?.hero.friendsConnection.__data == last?.data?.hero.friendsConnection.__data)
data.hero.friendsConnection.__data._data equal: \(first?.data?.hero.friendsConnection.__data._data == last?.data?.hero.friendsConnection.__data._data)
data.hero.friendsConnection.__data._fulfilledFragments equal: \(first?.data?.hero.friendsConnection.__data._fulfilledFragments == last?.data?.hero.friendsConnection.__data._fulfilledFragments)
data.hero.friendsConnection.__data._deferredFragments equal: \(first?.data?.hero.friendsConnection.__data._deferredFragments == last?.data?.hero.friendsConnection.__data._deferredFragments)
data.hero.friendsConnection.__typename equal: \(first?.data?.hero.friendsConnection.__typename == last?.data?.hero.friendsConnection.__typename)
data.hero.friendsConnection.totalCount equal: \(first?.data?.hero.friendsConnection.totalCount == last?.data?.hero.friendsConnection.totalCount)
data.hero.friendsConnection.friends equal: \(first?.data?.hero.friendsConnection.friends == last?.data?.hero.friendsConnection.friends)
data.hero.friendsConnection.pageInfo equal: \(first?.data?.hero.friendsConnection.pageInfo == last?.data?.hero.friendsConnection.pageInfo)
""")
XCTAssertEqual(try? result.get().initialPage, try? newResult.get().initialPage)
XCTAssertFalse(output.nextPages.isEmpty)
XCTAssertEqual(output.nextPages.count, 1)
Expand Down
24 changes: 24 additions & 0 deletions Tests/ApolloPaginationTests/ReversePaginationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,30 @@ final class ReversePaginationTests: XCTestCase, CacheDependentTesting {

try XCTAssertSuccessResult(result) { output in
// Assert first page is unchanged
let first = try? results.first?.get().initialPage
let last = try? results.last?.get().initialPage
print("""
\(#function) - equality
equal: \(first == last)
data equal: \(first?.data == last?.data)
data.hero equal: \(first?.data?.hero == last?.data?.hero)
data.hero.__typename equal: \(first?.data?.hero.__typename == last?.data?.hero.__typename)
data.hero.id equal: \(first?.data?.hero.id == last?.data?.hero.id)
data.hero.name equal: \(first?.data?.hero.name == last?.data?.hero.name)
data.hero.friendsConnection equal: \(first?.data?.hero.friendsConnection == last?.data?.hero.friendsConnection)
hashes - lhs:\(first?.data?.hero.friendsConnection.hashValue) rhs:\(last?.data?.hero.friendsConnection.hashValue)
data.hero.friendsConnection.__data equal: \(first?.data?.hero.friendsConnection.__data == last?.data?.hero.friendsConnection.__data)
data.hero.friendsConnection.__data._data equal: \(first?.data?.hero.friendsConnection.__data._data == last?.data?.hero.friendsConnection.__data._data)
data.hero.friendsConnection.__data._fulfilledFragments equal: \(first?.data?.hero.friendsConnection.__data._fulfilledFragments == last?.data?.hero.friendsConnection.__data._fulfilledFragments)
data.hero.friendsConnection.__data._deferredFragments equal: \(first?.data?.hero.friendsConnection.__data._deferredFragments == last?.data?.hero.friendsConnection.__data._deferredFragments)
data.hero.friendsConnection.__typename equal: \(first?.data?.hero.friendsConnection.__typename == last?.data?.hero.friendsConnection.__typename)
data.hero.friendsConnection.__objectType equal: \(first?.data?.hero.friendsConnection.__objectType == last?.data?.hero.friendsConnection.__objectType)
data.hero.friendsConnection._fieldData equal: \(first?.data?.hero.friendsConnection._fieldData == last?.data?.hero.friendsConnection._fieldData)
data.hero.friendsConnection._rawData equal: \(first?.data?.hero.friendsConnection._rawData == last?.data?.hero.friendsConnection._rawData)
data.hero.friendsConnection.totalCount equal: \(first?.data?.hero.friendsConnection.totalCount == last?.data?.hero.friendsConnection.totalCount)
data.hero.friendsConnection.friends equal: \(first?.data?.hero.friendsConnection.friends == last?.data?.hero.friendsConnection.friends)
data.hero.friendsConnection.pageInfo equal: \(first?.data?.hero.friendsConnection.pageInfo == last?.data?.hero.friendsConnection.pageInfo)
""")
XCTAssertEqual(try? results.first?.get().initialPage, try? results.last?.get().initialPage)

XCTAssertFalse(output.previousPages.isEmpty)
Expand Down
Loading
Loading