We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bef95eb commit 740ee09Copy full SHA for 740ee09
Tests/BetterCodableTests/DefaultFalseTests.swift
@@ -11,6 +11,12 @@ class DefaultFalseTests: XCTestCase {
11
let fixture = try JSONDecoder().decode(Fixture.self, from: jsonData)
12
XCTAssertEqual(fixture.truthy, false)
13
}
14
+
15
+ func testDecodingKeyNotPresentDefaultsToFalse() throws {
16
+ let jsonData = #"{}"#.data(using: .utf8)!
17
+ let fixture = try JSONDecoder().decode(Fixture.self, from: jsonData)
18
+ XCTAssertEqual(fixture.truthy, false)
19
+ }
20
21
func testEncodingDecodedFailableArrayDefaultsToEmptyArray() throws {
22
let jsonData = #"{ "truthy": null }"#.data(using: .utf8)!
0 commit comments