Skip to content

Commit 32ad542

Browse files
Add unit tests for CustomHelpCenterContent.
1 parent 3b8cb01 commit 32ad542

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

WooCommerce/WooCommerce.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,6 +1757,7 @@
17571757
E1ED16E4266E10A10037B8DB /* ApplicationLogViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1ED16E3266E10A10037B8DB /* ApplicationLogViewModel.swift */; };
17581758
E1F52DC62668E03B00349D75 /* CardPresentModalBluetoothRequired.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1F52DC52668E03B00349D75 /* CardPresentModalBluetoothRequired.swift */; };
17591759
EE0EE7A628B7415200F6061E /* CustomHelpCenterContent.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE0EE7A528B7415200F6061E /* CustomHelpCenterContent.swift */; };
1760+
EE0EE7A828B74EF300F6061E /* CustomHelpCenterContentTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE0EE7A728B74EF300F6061E /* CustomHelpCenterContentTests.swift */; };
17601761
EE81B1382865BB0B0032E0D4 /* ProductImagesProductIDUpdaterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE81B1372865BB0B0032E0D4 /* ProductImagesProductIDUpdaterTests.swift */; };
17611762
EEADF622281A40CB001B40F1 /* ShippingValueLocalizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEADF621281A40CB001B40F1 /* ShippingValueLocalizer.swift */; };
17621763
EEADF624281A421A001B40F1 /* DefaultShippingValueLocalizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEADF623281A421A001B40F1 /* DefaultShippingValueLocalizer.swift */; };
@@ -3609,6 +3610,7 @@
36093610
E1ED16E3266E10A10037B8DB /* ApplicationLogViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApplicationLogViewModel.swift; sourceTree = "<group>"; };
36103611
E1F52DC52668E03B00349D75 /* CardPresentModalBluetoothRequired.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardPresentModalBluetoothRequired.swift; sourceTree = "<group>"; };
36113612
EE0EE7A528B7415200F6061E /* CustomHelpCenterContent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomHelpCenterContent.swift; sourceTree = "<group>"; };
3613+
EE0EE7A728B74EF300F6061E /* CustomHelpCenterContentTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomHelpCenterContentTests.swift; sourceTree = "<group>"; };
36123614
EE81B1372865BB0B0032E0D4 /* ProductImagesProductIDUpdaterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductImagesProductIDUpdaterTests.swift; sourceTree = "<group>"; };
36133615
EEADF621281A40CB001B40F1 /* ShippingValueLocalizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShippingValueLocalizer.swift; sourceTree = "<group>"; };
36143616
EEADF623281A421A001B40F1 /* DefaultShippingValueLocalizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefaultShippingValueLocalizer.swift; sourceTree = "<group>"; };
@@ -6855,6 +6857,7 @@
68556857
455A2FDA246B1349000CA72C /* ProductVisibilityTests.swift */,
68566858
FEEB2F60268A215E0075A6E0 /* StorageEligibilityErrorInfoWooTests.swift */,
68576859
DE001322279A793A00EB0350 /* CouponWooTests.swift */,
6860+
EE0EE7A728B74EF300F6061E /* CustomHelpCenterContentTests.swift */,
68586861
);
68596862
path = Model;
68606863
sourceTree = "<group>";
@@ -10203,6 +10206,7 @@
1020310206
D8610BF7256F5F0900A5DF27 /* ULErrorViewControllerTests.swift in Sources */,
1020410207
02279594237A60FD00787C63 /* AztecHeaderFormatBarCommandTests.swift in Sources */,
1020510208
0259EF77246BF4EC00B84FDF /* ProductDetailsFactoryTests.swift in Sources */,
10209+
EE0EE7A828B74EF300F6061E /* CustomHelpCenterContentTests.swift in Sources */,
1020610210
4574745F24EA9ADE00CF49BC /* ProductTypeBottomSheetListSelectorCommandTests.swift in Sources */,
1020710211
AEE2611126E6785400B142A0 /* EditOrderAddressFormViewModelTests.swift in Sources */,
1020810212
0212683724C049F000F8A892 /* ProductListMultiSelectorDataSourceTests.swift in Sources */,
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import XCTest
2+
@testable import WordPressAuthenticator
3+
@testable import WooCommerce
4+
5+
final class CustomHelpCenterContentTests: XCTestCase {
6+
7+
func test_step_key_has_correct_rawValue() {
8+
let sut = CustomHelpCenterContent.Key.step
9+
XCTAssertEqual(sut.rawValue, "source_step")
10+
}
11+
12+
func test_flow_key_has_correct_rawValue() {
13+
let sut = CustomHelpCenterContent.Key.flow
14+
XCTAssertEqual(sut.rawValue, "source_flow")
15+
}
16+
17+
func test_url_key_has_correct_rawValue() {
18+
let sut = CustomHelpCenterContent.Key.url
19+
XCTAssertEqual(sut.rawValue, "help_content_url")
20+
}
21+
22+
func test_init_using_step_and_flow_returns_valid_instance_for_enter_store_address_screen() throws {
23+
// Given
24+
let step: AuthenticatorAnalyticsTracker.Step = .start
25+
let flow: AuthenticatorAnalyticsTracker.Flow = .loginWithSiteAddress
26+
let helpContentURL = WooConstants.URLs.helpCenterForEnterStoreAddress.asURL()
27+
28+
// When
29+
let sut = try XCTUnwrap(CustomHelpCenterContent(step: step, flow: flow))
30+
31+
// Then
32+
XCTAssertEqual(sut.helpCenterContentURL, helpContentURL)
33+
34+
// Test the `trackingProperties` dictionary values
35+
XCTAssertEqual(sut.trackingProperties[CustomHelpCenterContent.Key.step.rawValue], step.rawValue)
36+
XCTAssertEqual(sut.trackingProperties[CustomHelpCenterContent.Key.flow.rawValue], flow.rawValue)
37+
XCTAssertEqual(sut.trackingProperties[CustomHelpCenterContent.Key.url.rawValue], helpContentURL.absoluteString)
38+
}
39+
}

0 commit comments

Comments
 (0)