Skip to content

Commit 20569e9

Browse files
committed
Add test
1 parent b7c7032 commit 20569e9

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

WooCommerce/WooCommerceTests/ViewRelated/Dashboard/Analytics Hub/AnalyticsHubViewModelTests.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,22 @@ final class AnalyticsHubViewModelTests: XCTestCase {
118118
XCTAssertEqual(loadingItemsSoldCard?.isRedacted, true)
119119
XCTAssertEqual(loadingSessionsCard?.isRedacted, true)
120120
}
121+
122+
func test_session_card_is_hidden_for_custom_range() async {
123+
// Given
124+
let vm = AnalyticsHubViewModel(siteID: 123, statsTimeRange: .today, usageTracksEventEmitter: eventEmitter, stores: stores)
125+
XCTAssertTrue(vm.showSessionsCard)
126+
127+
// When
128+
vm.timeRangeSelectionType = .custom(start: Date(), end: Date())
129+
130+
// Then
131+
XCTAssertFalse(vm.showSessionsCard)
132+
133+
// When
134+
vm.timeRangeSelectionType = .lastMonth
135+
136+
// Then
137+
XCTAssertTrue(vm.showSessionsCard)
138+
}
121139
}

0 commit comments

Comments
 (0)