@@ -29,6 +29,10 @@ import { FirebaseError } from '@firebase/util';
29
29
use ( chaiAsPromised ) ;
30
30
31
31
describe ( 'api/password_policy/getPasswordPolicy' , ( ) => {
32
+ const TEST_MIN_PASSWORD_LENGTH = 6 ;
33
+ const TEST_ALLOWED_NON_ALPHANUMERIC_CHARS = [ '!' ] ;
34
+ const TEST_SCHEMA_VERSION = 1 ;
35
+
32
36
let auth : TestAuth ;
33
37
34
38
beforeEach ( async ( ) => {
@@ -41,16 +45,20 @@ describe('api/password_policy/getPasswordPolicy', () => {
41
45
it ( 'should GET to the correct endpoint' , async ( ) => {
42
46
const mock = mockEndpoint ( Endpoint . GET_PASSWORD_POLICY , {
43
47
customStrengthOptions : {
44
- minPasswordLength : 6
48
+ minPasswordLength : TEST_MIN_PASSWORD_LENGTH
45
49
} ,
46
- allowedNonAlphanumericCharacters : [ '!' ] ,
47
- schemaVersion : 1
50
+ allowedNonAlphanumericCharacters : TEST_ALLOWED_NON_ALPHANUMERIC_CHARS ,
51
+ schemaVersion : TEST_SCHEMA_VERSION
48
52
} ) ;
49
53
50
54
const response = await _getPasswordPolicy ( auth ) ;
51
- expect ( response . customStrengthOptions . minPasswordLength ) . to . eql ( 6 ) ;
52
- expect ( response . allowedNonAlphanumericCharacters ) . to . eql ( [ '!' ] ) ;
53
- expect ( response . schemaVersion ) . to . eql ( 1 ) ;
55
+ expect ( response . customStrengthOptions . minPasswordLength ) . to . eql (
56
+ TEST_MIN_PASSWORD_LENGTH
57
+ ) ;
58
+ expect ( response . allowedNonAlphanumericCharacters ) . to . eql (
59
+ TEST_ALLOWED_NON_ALPHANUMERIC_CHARS
60
+ ) ;
61
+ expect ( response . schemaVersion ) . to . eql ( TEST_SCHEMA_VERSION ) ;
54
62
expect ( mock . calls [ 0 ] . method ) . to . eq ( 'GET' ) ;
55
63
expect ( mock . calls [ 0 ] . headers ! . get ( HttpHeader . X_CLIENT_VERSION ) ) . to . eq (
56
64
'testSDK/0.0.0'
0 commit comments