File tree 2 files changed +20
-1
lines changed
packages/functional-tests
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -12,10 +12,24 @@ function wait() {
12
12
export class SmsClient {
13
13
private client : RedisType ;
14
14
private uidCodes : Map < string , string > ;
15
+ private isConnected = false ;
16
+ private hasLoggedConnectionError = false ;
15
17
16
18
constructor ( ) {
17
19
this . client = new Redis ( ) ;
18
20
this . uidCodes = new Map ( ) ;
21
+
22
+ this . client . on ( 'ready' , ( ) => {
23
+ this . isConnected = true ;
24
+ this . hasLoggedConnectionError = false ;
25
+ } ) ;
26
+
27
+ this . client . on ( 'error' , ( err : Error ) => {
28
+ if ( ! this . hasLoggedConnectionError ) {
29
+ this . hasLoggedConnectionError = true ;
30
+ }
31
+ this . isConnected = false ;
32
+ } ) ;
19
33
}
20
34
21
35
/**
@@ -25,6 +39,10 @@ export class SmsClient {
25
39
* @param timeout
26
40
*/
27
41
async getCode ( uid : string , timeout = 10000 ) : Promise < string > {
42
+ if ( ! this . isConnected ) {
43
+ throw new Error ( 'Not connected to Redis' ) ;
44
+ }
45
+
28
46
const redisKeyPattern = `recovery-phone:sms-attempt:${ uid } :*` ;
29
47
const expires = Date . now ( ) + timeout ;
30
48
Original file line number Diff line number Diff line change @@ -18,9 +18,10 @@ import { getCode } from 'fxa-settings/src/lib/totp';
18
18
19
19
test . describe ( 'severity-1 #smoke' , ( ) => {
20
20
test . describe ( 'recovery phone' , ( ) => {
21
- test . beforeEach ( async ( { pages : { configPage } } ) => {
21
+ test . beforeEach ( async ( { pages : { configPage } } , { project } ) => {
22
22
// Ensure that the feature flag is enabled
23
23
const config = await configPage . getConfig ( ) ;
24
+ test . fixme ( project . name !== 'local' , 'FXA-11159' ) ;
24
25
test . skip ( config . featureFlags . enableAdding2FABackupPhone !== true ) ;
25
26
test . skip ( config . featureFlags . enableUsing2FABackupPhone !== true ) ;
26
27
} ) ;
You can’t perform that action at this time.
0 commit comments