Skip to content

Commit 658ffe8

Browse files
committed
Adds Product Onboarding Test
1 parent dd4d119 commit 658ffe8

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

Networking/Networking.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@
165165
267313312559CC930026F7EF /* PaymentGateway.swift in Sources */ = {isa = PBXBuildFile; fileRef = 267313302559CC930026F7EF /* PaymentGateway.swift */; };
166166
26731337255ACA850026F7EF /* PaymentGatewayListMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26731336255ACA850026F7EF /* PaymentGatewayListMapper.swift */; };
167167
2676F4CE290AE6BB00C7A15B /* EntityIDMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2676F4CD290AE6BB00C7A15B /* EntityIDMapper.swift */; };
168+
2676F4D0290B0EC800C7A15B /* product-id-only.json in Resources */ = {isa = PBXBuildFile; fileRef = 2676F4CF290B0EC700C7A15B /* product-id-only.json */; };
168169
2683D70E24456DB8002A1589 /* categories-empty.json in Resources */ = {isa = PBXBuildFile; fileRef = 2683D70D24456DB7002A1589 /* categories-empty.json */; };
169170
2683D71024456EE4002A1589 /* categories-extra.json in Resources */ = {isa = PBXBuildFile; fileRef = 2683D70F24456EE4002A1589 /* categories-extra.json */; };
170171
2685C0D2263B069500D9EE97 /* AddOnGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2685C0D1263B069500D9EE97 /* AddOnGroup.swift */; };
@@ -889,6 +890,7 @@
889890
267313302559CC930026F7EF /* PaymentGateway.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaymentGateway.swift; sourceTree = "<group>"; };
890891
26731336255ACA850026F7EF /* PaymentGatewayListMapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaymentGatewayListMapper.swift; sourceTree = "<group>"; };
891892
2676F4CD290AE6BB00C7A15B /* EntityIDMapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntityIDMapper.swift; sourceTree = "<group>"; };
893+
2676F4CF290B0EC700C7A15B /* product-id-only.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "product-id-only.json"; sourceTree = "<group>"; };
892894
2683D70D24456DB7002A1589 /* categories-empty.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "categories-empty.json"; sourceTree = "<group>"; };
893895
2683D70F24456EE4002A1589 /* categories-extra.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "categories-extra.json"; sourceTree = "<group>"; };
894896
2685C0D1263B069500D9EE97 /* AddOnGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddOnGroup.swift; sourceTree = "<group>"; };
@@ -2085,6 +2087,7 @@
20852087
09885C7F27C3FFD200910A62 /* product-variations-bulk-update.json */,
20862088
451274A525276C82009911FF /* product-variation.json */,
20872089
CE0A0F1E223998A00075ED8D /* products-load-all.json */,
2090+
2676F4CF290B0EC700C7A15B /* product-id-only.json */,
20882091
CCF434652906C2A400B4475A /* products-ids-only.json */,
20892092
CCF434692906C9C300B4475A /* products-ids-only-empty.json */,
20902093
0282DD90233A120A006A5FDB /* products-search-photo.json */,
@@ -2824,6 +2827,7 @@
28242827
68CB801628D8A39700E169F8 /* customer.json in Resources */,
28252828
03EB99982907F4AA00F06A39 /* just-in-time-message-list-multiple.json in Resources */,
28262829
451A97DE260B59870059D135 /* shipping-label-packages-success.json in Resources */,
2830+
2676F4D0290B0EC800C7A15B /* product-id-only.json in Resources */,
28272831
31D27C8F2602B553002EDB1D /* plugins.json in Resources */,
28282832
261CF1B4255AD6B30090D8D3 /* payment-gateway-list.json in Resources */,
28292833
268B68FB24C87384007EBF1D /* leaderboards-products.json in Resources */,

Networking/NetworkingTests/Remote/ProductsRemoteTests.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,23 @@ final class ProductsRemoteTests: XCTestCase {
620620
// Then
621621
XCTAssertTrue(result.isFailure)
622622
}
623+
624+
func test_create_template_product_returns_product_id() throws {
625+
// Given
626+
let remote = ProductsRemote(network: network)
627+
network.simulateResponse(requestUrlSuffix: "onboarding/tasks/create_product_from_template", filename: "product-id-only")
628+
629+
// When
630+
let result = waitFor { promise in
631+
remote.createTemplateProduct(for: self.sampleSiteID, template: .physical) { result in
632+
promise(result)
633+
}
634+
}
635+
636+
// Then
637+
let productID = try XCTUnwrap(result.get())
638+
XCTAssertEqual(productID, 3946)
639+
}
623640
}
624641

625642
// MARK: - Private Helpers
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"data": {
3+
"id": 3946
4+
}
5+
}

0 commit comments

Comments
 (0)