1 import XCTest 2 3 @testable import EXDevMenu 4 5 class MockedNOOPBridge: RCTBridge { 6 override func invalidate() { 7 // NOOP 8 } 9 10 override func setUp() { 11 bundleURL = URL(string: "http://localhost:1234") 12 } 13 } 14 15 class EXDevMenuAppInfoTest: XCTestCase { 16 func test_if_app_info_uses_provided_data() { 17 let manifest = [ 18 "name": "Test App", 19 "version": "123" 20 ] 21 22 let appInfo = EXDevMenuAppInfo.getFor(MockedNOOPBridge(delegate: nil, launchOptions: nil), andManifest: manifest) 23 24 XCTAssertEqual(appInfo["appName"] as! String, "Test App") 25 XCTAssertEqual(appInfo["appVersion"] as! String, "123") 26 XCTAssertEqual(appInfo["hostUrl"] as! String, "localhost") 27 } 28 29 func test_if_app_info_gets_host_from_bridge() { 30 let appInfo = EXDevMenuAppInfo.getFor(MockedNOOPBridge(delegate: nil, launchOptions: nil), andManifest: [:]) 31 32 let host = appInfo["hostUrl"] as! String 33 XCTAssertEqual(host, "localhost") 34 } 35 } 36