-
Notifications
You must be signed in to change notification settings - Fork 731
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add conformance with conflicting name test
- Loading branch information
1 parent
d93227f
commit 1362c67
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import XCTest | ||
import ApolloAPI | ||
import Nimble | ||
|
||
final class InputObjectTests: XCTestCase { | ||
|
||
struct MockInputObject: InputObject { | ||
var __data: InputDict | ||
|
||
init(_ data: InputDict) { | ||
__data = data | ||
} | ||
|
||
init(hash: GraphQLNullable<String> = nil) { | ||
__data = InputDict(["hash": hash]) | ||
} | ||
|
||
public var hash: GraphQLNullable<String> { | ||
get { __data["hash"] } | ||
set { __data["hash"] = newValue } | ||
} | ||
} | ||
|
||
func test__inputDict__shouldConformToHashable() { | ||
// given | ||
let subject = MockInputObject(hash: .some("MyValue")) | ||
|
||
// then | ||
var hasher = Hasher() | ||
subject.hash(into: &hasher) | ||
} | ||
|
||
func test__inputDict__givenPropertyNameMatchingHashableFunctionName_shouldInitializeWithPropertyName() { | ||
// given | ||
let subject = MockInputObject(hash: .some("MyValue")) | ||
|
||
// then | ||
expect(subject.hash).to(equal(.some("MyValue"))) | ||
} | ||
|
||
func test__inputDict__givenPropertyNameMatchingHashableFunctionName_shouldInitializeWithInputDict() { | ||
// given | ||
let subject = MockInputObject(.init(["hash": GraphQLNullable.some("MyValue")])) | ||
|
||
// then | ||
expect(subject.hash).to(equal(.some("MyValue"))) | ||
} | ||
|
||
} |