@@ -51,7 +51,14 @@ export async function createAppContextWithRealCrypto(identifier) {
5151 return createAppContext ( { identifier, crypto : new SNWebCrypto ( ) } )
5252}
5353
54- export async function createAppContext ( { identifier, crypto, email, password, host, syncCallsThresholdPerMinute } = { } ) {
54+ export async function createAppContext ( {
55+ identifier,
56+ crypto,
57+ email,
58+ password,
59+ host,
60+ syncCallsThresholdPerMinute,
61+ } = { } ) {
5562 const context = new AppContext ( { identifier, crypto, email, password, host, syncCallsThresholdPerMinute } )
5663 await context . initialize ( )
5764 return context
@@ -250,7 +257,14 @@ export async function awaitFunctionInvokation(object, functionName) {
250257 * A new one must be created.
251258 */
252259export async function signOutApplicationAndReturnNew ( application ) {
253- const isRealCrypto = application . crypto instanceof SNWebCrypto
260+ if ( ! application ) {
261+ throw Error ( '[signOutApplicationAndReturnNew] Application is undefined' )
262+ }
263+ if ( ! application . options . crypto ) {
264+ throw Error ( '[signOutApplicationAndReturnNew] Application.options.crypto is undefined' )
265+ }
266+
267+ const isRealCrypto = application . options . crypto instanceof SNWebCrypto
254268 await application . user . signOut ( )
255269 if ( isRealCrypto ) {
256270 return createInitAppWithRealCrypto ( )
@@ -260,7 +274,7 @@ export async function signOutApplicationAndReturnNew(application) {
260274}
261275
262276export async function signOutAndBackIn ( application , email , password ) {
263- const isRealCrypto = application . crypto instanceof SNWebCrypto
277+ const isRealCrypto = application . options . crypto instanceof SNWebCrypto
264278 await application . user . signOut ( )
265279 const newApplication = isRealCrypto ? await createInitAppWithRealCrypto ( ) : await createInitAppWithFakeCrypto ( )
266280 await this . loginToApplication ( {
0 commit comments