@@ -47,6 +47,9 @@ describe("AppStringProcessor", function () {
47
47
expect ( result . isError ) . toBeDefined ( ) ;
48
48
49
49
expect ( result . error . code ) . toBe ( "error.appStringProcessor.truncatedReferenceInvalid" ) ;
50
+
51
+ expect ( mockUiBridge . enterPasswordNotCalled ( ) ) . toBeTruthy ( ) ;
52
+ expect ( mockUiBridge . requestAccountSelectionNotCalled ( ) ) . toBeTruthy ( ) ;
50
53
} ) ;
51
54
52
55
test ( "should properly handle a personalized RelationshipTemplate with the correct Identity available" , async function ( ) {
@@ -63,6 +66,9 @@ describe("AppStringProcessor", function () {
63
66
expect ( result ) . toBeSuccessful ( ) ;
64
67
65
68
await expect ( eventBus ) . toHavePublished ( PeerRelationshipTemplateLoadedEvent ) ;
69
+
70
+ expect ( mockUiBridge . enterPasswordNotCalled ( ) ) . toBeTruthy ( ) ;
71
+ expect ( mockUiBridge . requestAccountSelectionNotCalled ( ) ) . toBeTruthy ( ) ;
66
72
} ) ;
67
73
68
74
test ( "should properly handle a personalized RelationshipTemplate with the correct Identity not available" , async function ( ) {
@@ -77,6 +83,9 @@ describe("AppStringProcessor", function () {
77
83
78
84
const result = await runtime2 . stringProcessor . processTruncatedReference ( templateResult . value . truncatedReference ) ;
79
85
expect ( result ) . toBeAnError ( "There is no account matching the given 'forIdentityTruncated'." , "error.appruntime.general.noAccountAvailableForIdentityTruncated" ) ;
86
+
87
+ expect ( mockUiBridge . enterPasswordNotCalled ( ) ) . toBeTruthy ( ) ;
88
+ expect ( mockUiBridge . requestAccountSelectionNotCalled ( ) ) . toBeTruthy ( ) ;
80
89
} ) ;
81
90
82
91
test ( "should properly handle a password protected RelationshipTemplate" , async function ( ) {
@@ -94,6 +103,9 @@ describe("AppStringProcessor", function () {
94
103
expect ( result . value ) . toBeUndefined ( ) ;
95
104
96
105
await expect ( eventBus ) . toHavePublished ( PeerRelationshipTemplateLoadedEvent ) ;
106
+
107
+ expect ( mockUiBridge . enterPasswordCalled ( "pw" ) ) . toBeTruthy ( ) ;
108
+ expect ( mockUiBridge . requestAccountSelectionCalled ( 2 ) ) . toBeTruthy ( ) ;
97
109
} ) ;
98
110
99
111
test ( "should properly handle a pin protected RelationshipTemplate" , async function ( ) {
@@ -111,6 +123,9 @@ describe("AppStringProcessor", function () {
111
123
expect ( result . value ) . toBeUndefined ( ) ;
112
124
113
125
await expect ( eventBus ) . toHavePublished ( PeerRelationshipTemplateLoadedEvent ) ;
126
+
127
+ expect ( mockUiBridge . enterPasswordCalled ( "pin" , 6 ) ) . toBeTruthy ( ) ;
128
+ expect ( mockUiBridge . requestAccountSelectionCalled ( 2 ) ) . toBeTruthy ( ) ;
114
129
} ) ;
115
130
116
131
test ( "should properly handle a password protected personalized RelationshipTemplate" , async function ( ) {
@@ -128,6 +143,9 @@ describe("AppStringProcessor", function () {
128
143
expect ( result . value ) . toBeUndefined ( ) ;
129
144
130
145
await expect ( eventBus ) . toHavePublished ( PeerRelationshipTemplateLoadedEvent ) ;
146
+
147
+ expect ( mockUiBridge . enterPasswordCalled ( "pw" ) ) . toBeTruthy ( ) ;
148
+ expect ( mockUiBridge . requestAccountSelectionNotCalled ( ) ) . toBeTruthy ( ) ;
131
149
} ) ;
132
150
133
151
test ( "should properly handle a pin protected personalized RelationshipTemplate" , async function ( ) {
@@ -145,5 +163,36 @@ describe("AppStringProcessor", function () {
145
163
expect ( result . value ) . toBeUndefined ( ) ;
146
164
147
165
await expect ( eventBus ) . toHavePublished ( PeerRelationshipTemplateLoadedEvent ) ;
166
+
167
+ expect ( mockUiBridge . enterPasswordCalled ( "pin" , 6 ) ) . toBeTruthy ( ) ;
168
+ expect ( mockUiBridge . requestAccountSelectionNotCalled ( ) ) . toBeTruthy ( ) ;
169
+ } ) ;
170
+
171
+ describe ( "onboarding" , function ( ) {
172
+ let runtime3 : AppRuntime ;
173
+ const runtime3MockUiBridge = new MockUIBridge ( ) ;
174
+
175
+ beforeAll ( async function ( ) {
176
+ runtime3 = await TestUtil . createRuntime ( undefined , runtime3MockUiBridge , eventBus ) ;
177
+ await runtime3 . start ( ) ;
178
+ } ) ;
179
+
180
+ afterAll ( async ( ) => await runtime3 . stop ( ) ) ;
181
+
182
+ test ( "device onboarding with a password protected Token" , async function ( ) {
183
+ const deviceResult = await runtime1Session . transportServices . devices . createDevice ( { } ) ;
184
+ const tokenResult = await runtime1Session . transportServices . devices . getDeviceOnboardingToken ( {
185
+ id : deviceResult . value . id ,
186
+ passwordProtection : { password : "password" }
187
+ } ) ;
188
+
189
+ mockUiBridge . passwordToReturn = "password" ;
190
+
191
+ const result = await runtime2 . stringProcessor . processTruncatedReference ( tokenResult . value . truncatedReference ) ;
192
+ expect ( result ) . toBeSuccessful ( ) ;
193
+ expect ( result . value ) . toBeUndefined ( ) ;
194
+
195
+ expect ( mockUiBridge . showDeviceOnboardingCalled ( deviceResult . value . id ) ) . toBeTruthy ( ) ;
196
+ } ) ;
148
197
} ) ;
149
198
} ) ;
0 commit comments