VulpesOS/gaia/apps/system/test/unit/mock_fxa_client.js
OverSu b38dea0597 Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
2026-09-30 23:13:03 +02:00

50 lines
1.1 KiB
JavaScript
Executable file

'use strict';
/* exported MockFxAccountsClient */
var MockFxAccountsClient = {
_errorMsg: null,
_successMsg: null,
_call: null,
_email: null,
_reset: function() {
this._call = null;
this._errorMsg = null;
this._successMsg = null;
this._email = null;
},
_triggerCallback: function(successCb, errorCb) {
if (this._errorMsg) {
errorCb && errorCb(this._errorMsg);
return;
}
successCb && successCb(this._successMsg);
},
getAccount: function(successCb, errorCb) {
this._call = 'getAccount';
this._triggerCallback(successCb, errorCb);
},
getAssertion: function(options, successCb, errorCb) {
this._call = 'getAssertion';
if (this._errorMsg) {
errorCb(this._errorMsg);
return;
}
successCb(Date.now() /* fake assertion */);
},
resendVerificationEmail: function(email, successCb, errorCb) {
this._email = email;
this._call = 'resendVerificationEmail';
this._triggerCallback(successCb, errorCb);
},
logout: function(successCb, errorCb) {
this._call = 'logout';
this._triggerCallback(successCb, errorCb);
}
};