@@ -52,7 +52,7 @@ final class ProductDetailsViewModelTests: XCTestCase {
5252 brand: . fixture( name: " Product Brand " ) ,
5353 defaultVariant: variant,
5454 variants: [ variant] )
55- initViewModel ( productDetailsConfiguration : . product( product) )
55+ initViewModel ( configuration : . product( product) )
5656 XCTAssertEqual ( sut. productName, product. name)
5757 XCTAssertEqual ( sut. productTitle, product. brand. name)
5858 let colorSelectionConfiguration = sut. colorSelectionConfiguration
@@ -72,7 +72,7 @@ final class ProductDetailsViewModelTests: XCTestCase {
7272 let product = Product . fixture ( name: " Product Name " ,
7373 brand: . fixture( name: " Product Brand " ) ,
7474 variants: [ variant] )
75- initViewModel ( productDetailsConfiguration : . product( product) )
75+ initViewModel ( configuration : . product( product) )
7676 XCTAssertEqual ( sut. sizingSelectionConfiguration. items. count, 0 )
7777 }
7878
@@ -83,7 +83,7 @@ final class ProductDetailsViewModelTests: XCTestCase {
8383 XCTAssertTrue ( sut. productId. isEmpty)
8484
8585 let productId = " 1 "
86- initViewModel ( productDetailsConfiguration : . id( productId) )
86+ initViewModel ( configuration : . id( productId) )
8787 XCTAssertEqual ( sut. productId, productId)
8888 }
8989
@@ -94,7 +94,7 @@ final class ProductDetailsViewModelTests: XCTestCase {
9494
9595 func test_product_title_is_available_after_fetching_product( ) {
9696 let product = Product . fixture ( brand: . fixture( name: " Product Brand " ) )
97- initViewModel ( productDetailsConfiguration : . product( product) )
97+ initViewModel ( configuration : . product( product) )
9898
9999 captureEvent ( fromPublisher: sut. $state. drop ( while: { $0. isLoading } ) . eraseToAnyPublisher ( ) , afterTrigger: {
100100 sut. viewDidAppear ( )
@@ -110,7 +110,7 @@ final class ProductDetailsViewModelTests: XCTestCase {
110110
111111 func test_product_name_is_available_after_fetching_product( ) {
112112 let product = Product . fixture ( name: " Product Name " )
113- initViewModel ( productDetailsConfiguration : . product( product) )
113+ initViewModel ( configuration : . product( product) )
114114
115115 captureEvent ( fromPublisher: sut. $state. drop ( while: { $0. isLoading } ) . eraseToAnyPublisher ( ) , afterTrigger: {
116116 sut. viewDidAppear ( )
@@ -133,7 +133,7 @@ final class ProductDetailsViewModelTests: XCTestCase {
133133 let product = Product . fixture ( name: " Product Name " ,
134134 defaultVariant: variant,
135135 variants: [ variant] )
136- initViewModel ( productDetailsConfiguration : . product( product) )
136+ initViewModel ( configuration : . product( product) )
137137
138138 captureEvent ( fromPublisher: sut. $state. drop ( while: { $0. isLoading } ) . eraseToAnyPublisher ( ) , afterTrigger: {
139139 sut. viewDidAppear ( )
@@ -160,7 +160,7 @@ final class ProductDetailsViewModelTests: XCTestCase {
160160
161161 func test_product_description_is_available_after_fetching_product( ) {
162162 let product = Product . fixture ( longDescription: " Product Description " )
163- initViewModel ( productDetailsConfiguration : . product( product) )
163+ initViewModel ( configuration : . product( product) )
164164
165165 captureEvent ( fromPublisher: sut. $state. drop ( while: { $0. isLoading } ) . eraseToAnyPublisher ( ) , afterTrigger: {
166166 sut. viewDidAppear ( )
@@ -175,7 +175,7 @@ final class ProductDetailsViewModelTests: XCTestCase {
175175 }
176176
177177 func test_price_type_is_not_nil_with_sale_product( ) {
178- initViewModel ( productDetailsConfiguration : . product( Product . blazer) )
178+ initViewModel ( configuration : . product( Product . blazer) )
179179 guard case . sale( let fullPrice, let finalPrice) = sut. priceType else {
180180 XCTFail ( " Unexpected price type " )
181181 return
@@ -185,7 +185,7 @@ final class ProductDetailsViewModelTests: XCTestCase {
185185 }
186186
187187 func test_price_type_is_not_nil_with_range_price_product( ) {
188- initViewModel ( productDetailsConfiguration : . product( Product . hat) )
188+ initViewModel ( configuration : . product( Product . hat) )
189189 guard case . range( let lowerBound, let upperBound, let separator) = sut. priceType else {
190190 XCTFail ( " Unexpected price type " )
191191 return
@@ -196,7 +196,7 @@ final class ProductDetailsViewModelTests: XCTestCase {
196196 }
197197
198198 func test_price_type_is_not_nil_with_default_price_product( ) {
199- initViewModel ( productDetailsConfiguration : . product( Product . necklace) )
199+ initViewModel ( configuration : . product( Product . necklace) )
200200 guard case . default( let price) = sut. priceType else {
201201 XCTFail ( " Unexpected price type " )
202202 return
@@ -208,7 +208,7 @@ final class ProductDetailsViewModelTests: XCTestCase {
208208
209209 func test_product_is_fetched_when_view_appears( ) {
210210 let productId = " 1 "
211- initViewModel ( productDetailsConfiguration : . id( productId) )
211+ initViewModel ( configuration : . id( productId) )
212212
213213 let expectation = expectation ( description: " Wait for service call " )
214214 mockProductService. onGetProductCalled = { id in
@@ -223,7 +223,7 @@ final class ProductDetailsViewModelTests: XCTestCase {
223223
224224 func test_product_is_not_fetched_when_view_appears_if_already_fetched( ) {
225225 let productId = " 1 "
226- initViewModel ( productDetailsConfiguration : . id( productId) )
226+ initViewModel ( configuration : . id( productId) )
227227
228228 let firstExpectation = expectation ( description: " Wait for service call " )
229229 let secondExpectation = expectation ( description: " Wait for success state " )
@@ -355,7 +355,7 @@ final class ProductDetailsViewModelTests: XCTestCase {
355355
356356 func test_does_not_report_title_section_loading_when_placeholder_available( ) {
357357 let product = Product . fixture ( name: " Product Name " )
358- initViewModel ( productDetailsConfiguration : . product( product) )
358+ initViewModel ( configuration : . product( product) )
359359
360360 let result = sut. shouldShowLoading ( for: . titleHeader)
361361 XCTAssertFalse ( result)
@@ -628,7 +628,7 @@ final class ProductDetailsViewModelTests: XCTestCase {
628628 let product = Product . fixture ( name: " Product Name " ,
629629 defaultVariant: variant1,
630630 variants: [ variant1, variant2] )
631- initViewModel ( productDetailsConfiguration : . product( product) )
631+ initViewModel ( configuration : . product( product) )
632632
633633 mockProductService. onGetProductCalled = { _ in
634634 product
@@ -863,16 +863,15 @@ final class ProductDetailsViewModelTests: XCTestCase {
863863 brand: . fixture( name: " Product Brand " ) ,
864864 variants: ( expectedMatchedColors + expectedNonMatchedColors) . map { Product . Variant. fixture ( colour: $0) } )
865865
866- initViewModel ( productDetailsConfiguration: . product( product) )
867- let allSwatches = sut. colorSelectionConfiguration. items
866+ initViewModel ( configuration: . product( product) )
868867 let swatchesSearchResult = sut. colorSwatches ( filteredBy: " Col " )
869868 XCTAssertTrue ( swatchesSearchResult. map ( \. name) . contains ( expectedMatchedColors. map ( \. name) ) )
870869 XCTAssertFalse ( swatchesSearchResult. map ( \. name) . contains ( expectedNonMatchedColors. map ( \. name) ) )
871870 }
872871
873872 // MARK: - Helper methods
874873
875- private func initViewModel( productDetailsConfiguration : ProductDetailsConfiguration = . id( " " ) ) {
876- sut = . init( productDetailsConfiguration : productDetailsConfiguration , dependencies: mockDependencies)
874+ private func initViewModel( configuration : ProductDetailsConfiguration = . id( " " ) ) {
875+ sut = . init( configuration : configuration , dependencies: mockDependencies)
877876 }
878877}
0 commit comments