@@ -9,9 +9,9 @@ class SystemStatusMapperTests: XCTestCase {
99 ///
1010 private let dummySiteID : Int64 = 999999
1111
12- /// Verifies the SystemPlugin fields are parsed correctly.
12+ /// Verifies the SystemPlugin fields are parsed correctly for an active plugin
1313 ///
14- func test_SystemPlugin_fields_are_properly_parsed ( ) throws {
14+ func test_active_plugin_fields_are_properly_parsed ( ) throws {
1515 // Given
1616 let expectedSiteId : Int64 = 999999
1717 let expectedPlugin = " woocommerce/woocommerce.php "
@@ -21,7 +21,10 @@ class SystemStatusMapperTests: XCTestCase {
2121 let expectedVersionLatest = " 5.8.0 "
2222 let expectedAuthorName = " Automattic "
2323 let expectedAuthorUrl = " https://woocommerce.com "
24- let expectedNetworkActivated = false
24+ /// TODO - The mapper is overriding networkActivated to be true for active plugins in general
25+ /// When we fix #xxxx this test will need to be updated to properly test the
26+ /// new `activated` attribute that will be added to SystemPlugin instead
27+ let expectedNetworkActivated = true
2528
2629 // When
2730 let systemPlugins = try mapLoadSystemStatusResponse ( )
@@ -41,6 +44,42 @@ class SystemStatusMapperTests: XCTestCase {
4144 XCTAssertEqual ( systemPlugin. authorUrl, expectedAuthorUrl)
4245 XCTAssertEqual ( systemPlugin. networkActivated, expectedNetworkActivated)
4346 }
47+
48+ /// Verifies the SystemPlugin fields are parsed correctly for an inactive plugin
49+ ///
50+ func test_inactive_plugin_fields_are_properly_parsed( ) throws {
51+ // Given
52+ let expectedSiteId : Int64 = 999999
53+ let expectedPlugin = " hello.php "
54+ let expectedName = " Hello Dolly "
55+ let expectedUrl = " http://wordpress.org/plugins/hello-dolly/ "
56+ let expectedVersion = " 1.7.2 "
57+ let expectedVersionLatest = " 1.7.2 "
58+ let expectedAuthorName = " Matt Mullenweg "
59+ let expectedAuthorUrl = " http://ma.tt/ "
60+ /// TODO - The mapper is overriding networkActivated to be true for active plugins in general
61+ /// When we fix #xxxx this test will need to be updated to properly test the
62+ /// new `activated` attribute that will be added to SystemPlugin instead
63+ let expectedNetworkActivated = false
64+
65+ // When
66+ let systemPlugins = try mapLoadSystemStatusResponse ( )
67+
68+ // Then
69+ XCTAssertEqual ( systemPlugins. count, 6 )
70+
71+ let systemPlugin = systemPlugins [ 5 ]
72+ XCTAssertNotNil ( systemPlugin)
73+ XCTAssertEqual ( systemPlugin. siteID, expectedSiteId)
74+ XCTAssertEqual ( systemPlugin. plugin, expectedPlugin)
75+ XCTAssertEqual ( systemPlugin. name, expectedName)
76+ XCTAssertEqual ( systemPlugin. url, expectedUrl)
77+ XCTAssertEqual ( systemPlugin. version, expectedVersion)
78+ XCTAssertEqual ( systemPlugin. versionLatest, expectedVersionLatest)
79+ XCTAssertEqual ( systemPlugin. authorName, expectedAuthorName)
80+ XCTAssertEqual ( systemPlugin. authorUrl, expectedAuthorUrl)
81+ XCTAssertEqual ( systemPlugin. networkActivated, expectedNetworkActivated)
82+ }
4483}
4584
4685/// Private Methods.
0 commit comments