import Foundation
import Foundation
import XCTest
@testable import Bourne

class ArrayTests: XCTestCase {
    func testArrayDecoding() {
        let json = JSON([1])

        XCTAssertEqual(json.array?.first?.int, 1)
        XCTAssertEqual(json.array?.count, 1)
    }

    func testInvalidArrayDecoding() {
        let notAnArray = JSON(nil)

        XCTAssertNil(notAnArray.array)
        XCTAssertEqual(notAnArray.arrayValue, [])
    }

    static var allTests = [
        ("testArrayDecoding", testArrayDecoding),
        ("testInvalidArrayDecoding", testInvalidArrayDecoding),
    ]
}

import Foundation
import Foundation
import XCTest
@testable import Bourne

class ArrayTests: XCTestCase {
    func testArrayDecoding() {
        let json = JSON([1])

        XCTAssertEqual(json.array?.first?.int, 1)
        XCTAssertEqual(json.array?.count, 1)
    }

    static var allTests = [
        ("testArrayDecoding", testArrayDecoding),
    ]
}

--- 
+++ 
@@ -11,7 +11,15 @@
         XCTAssertEqual(json.array?.count, 1)
     }
 
+    func testInvalidArrayDecoding() {
+        let notAnArray = JSON(nil)
+
+        XCTAssertNil(notAnArray.array)
+        XCTAssertEqual(notAnArray.arrayValue, [])
+    }
+
     static var allTests = [
         ("testArrayDecoding", testArrayDecoding),
+        ("testInvalidArrayDecoding", testInvalidArrayDecoding),
     ]
 }
[Tests] Add cases for invalid arrays
