File tree 1 file changed +12
-3
lines changed 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -115,21 +115,30 @@ export class TestClient {
115
115
}
116
116
117
117
/**
118
- * Set up expectations that the client will upload device keys.
118
+ * Set up expectations that the client will upload device keys (and possibly one-time keys)
119
119
*/
120
120
public expectDeviceKeyUpload ( ) {
121
121
this . httpBackend
122
122
. when ( "POST" , "/keys/upload" )
123
123
. respond < IKeysUploadResponse , IUploadKeysRequest > ( 200 , ( _path , content ) => {
124
- expect ( content . one_time_keys ) . toBe ( undefined ) ;
125
124
expect ( content . device_keys ) . toBeTruthy ( ) ;
126
125
127
126
logger . log ( this + ": received device keys" ) ;
128
127
// we expect this to happen before any one-time keys are uploaded.
129
128
expect ( Object . keys ( this . oneTimeKeys ! ) . length ) . toEqual ( 0 ) ;
130
129
131
130
this . deviceKeys = content . device_keys ;
132
- return { one_time_key_counts : { signed_curve25519 : 0 } } ;
131
+
132
+ // the first batch of one-time keys may be uploaded at the same time.
133
+ if ( content . one_time_keys ) {
134
+ logger . log ( `${ this } : received ${ Object . keys ( content . one_time_keys ) . length } one-time keys` ) ;
135
+ this . oneTimeKeys = content . one_time_keys ;
136
+ }
137
+ return {
138
+ one_time_key_counts : {
139
+ signed_curve25519 : Object . keys ( this . oneTimeKeys ! ) . length ,
140
+ } ,
141
+ } ;
133
142
} ) ;
134
143
}
135
144
You can’t perform that action at this time.
0 commit comments