33// file, You can obtain one at http://mozilla.org/MPL/2.0/
44
55import Foundation
6- import OnboardingKit
76import UIKit
7+ @testable import OnboardingKit
88
9- // MARK: - Mock Types for Testing
10- enum MockOnboardingType {
9+ // MARK: - Mock Enums
10+ enum MockOnboardingType : Sendable {
1111 case welcome
1212 case feature
1313 case completion
1414}
1515
16- enum MockOnboardingPopupActionType {
16+ enum MockOnboardingPopupActionType : Sendable {
1717 case dismiss
1818 case learnMore
1919}
2020
21- enum MockOnboardingMultipleChoiceActionType : String , CaseIterable , Hashable {
21+ enum MockOnboardingMultipleChoiceActionType : String , CaseIterable , Hashable , Sendable {
2222 case optionA
2323 case optionB
2424 case optionC
2525}
2626
27- enum MockOnboardingActionType : String , CaseIterable , RawRepresentable {
27+ enum MockOnboardingActionType : String , CaseIterable , RawRepresentable , Sendable {
2828 case next
2929 case skip
3030 case complete
@@ -47,34 +47,33 @@ enum MockOnboardingActionType: String, CaseIterable, RawRepresentable {
4747 }
4848}
4949
50- // MARK: - Mock Protocol Implementation
51- final class MockOnboardingCardInfoModel : OnboardingCardInfoModelProtocol {
50+ // MARK: - Mock OnboardingCardInfoModel
51+ struct MockOnboardingCardInfoModel : OnboardingCardInfoModelProtocol {
5252 typealias OnboardingType = MockOnboardingType
5353 typealias OnboardingPopupActionType = MockOnboardingPopupActionType
5454 typealias OnboardingMultipleChoiceActionType = MockOnboardingMultipleChoiceActionType
5555 typealias OnboardingActionType = MockOnboardingActionType
5656
57- var cardType : OnboardingCardType
58- var name : String
59- var order : Int
60- var title : String
61- var body : String
62- var instructionsPopup : OnboardingInstructionsPopupInfoModel < OnboardingPopupActionType > ?
63- var link : OnboardingLinkInfoModel ?
64- var buttons : OnboardingButtons < OnboardingActionType >
65- var multipleChoiceButtons : [ OnboardingMultipleChoiceButtonModel < OnboardingMultipleChoiceActionType > ]
66- var onboardingType : OnboardingType
67- var a11yIdRoot : String
68- var imageID : String
69- var embededLinkText : [ EmbeddedLink ]
70-
71- var defaultSelectedButton : OnboardingMultipleChoiceButtonModel < OnboardingMultipleChoiceActionType > ?
57+ let cardType : OnboardingCardType
58+ let name : String
59+ let order : Int
60+ let title : String
61+ let body : String
62+ let instructionsPopup : OnboardingInstructionsPopupInfoModel < OnboardingPopupActionType > ?
63+ let link : OnboardingLinkInfoModel ?
64+ let buttons : OnboardingButtons < OnboardingActionType >
65+ let multipleChoiceButtons : [ OnboardingMultipleChoiceButtonModel < OnboardingMultipleChoiceActionType > ]
66+ let onboardingType : OnboardingType
67+ let a11yIdRoot : String
68+ let imageID : String
69+ let embededLinkText : [ EmbeddedLink ]
70+ let defaultSelectedButton : OnboardingMultipleChoiceButtonModel < OnboardingMultipleChoiceActionType > ?
7271
7372 var image : UIImage ? {
7473 return UIImage ( systemName: imageID)
7574 }
7675
77- required init (
76+ init (
7877 cardType: OnboardingCardType ,
7978 name: String ,
8079 order: Int ,
@@ -102,24 +101,27 @@ final class MockOnboardingCardInfoModel: OnboardingCardInfoModelProtocol {
102101 self . imageID = imageID
103102 self . instructionsPopup = instructionsPopup
104103 self . embededLinkText = embededLinkText
104+ self . defaultSelectedButton = multipleChoiceButtons. first
105105 }
106106
107107 // Convenience initializer for testing
108- convenience init ( name: String ) {
109- self . init (
108+ static func create ( name: String , order : Int = 0 ) -> MockOnboardingCardInfoModel {
109+ return MockOnboardingCardInfoModel (
110110 cardType: . basic,
111- // Assuming OnboardingCardType has a standard case
112111 name: name,
113- order: 0 ,
114- title: " Test Title " ,
115- body: " Test Body " ,
112+ order: order ,
113+ title: " Test Title for \( name ) " ,
114+ body: " Test Body for \( name ) " ,
116115 link: nil ,
117116 buttons: OnboardingButtons (
118117 primary: OnboardingButtonInfoModel (
119- title: " Primary Title " ,
120- action: . complete
118+ title: " Primary Button " ,
119+ action: . next
121120 ) ,
122- secondary: nil
121+ secondary: OnboardingButtonInfoModel (
122+ title: " Secondary Button " ,
123+ action: . skip
124+ )
123125 ) ,
124126 multipleChoiceButtons: [ ] ,
125127 onboardingType: . welcome,
0 commit comments