Skip to content

Commit e71513a

Browse files
authored
Use auth impl object instead of mock auth object (#3098)
1 parent 7b297c5 commit e71513a

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

packages-exp/auth-exp/src/core/auth/auth_impl.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const DEFAULT_TOKEN_API_HOST = 'securetoken.googleapis.com';
3838
export const DEFAULT_API_HOST = 'identitytoolkit.googleapis.com';
3939
export const DEFAULT_API_SCHEME = 'https';
4040

41-
class AuthImpl implements Auth {
41+
export class AuthImpl implements Auth {
4242
currentUser: User | null = null;
4343
private operations = Promise.resolve();
4444
private persistenceManager?: PersistenceUserManager;

packages-exp/auth-exp/test/mock_auth.ts

+8-16
Original file line numberDiff line numberDiff line change
@@ -15,38 +15,30 @@
1515
* limitations under the License.
1616
*/
1717

18+
import { AuthImpl } from '../src/core/auth/auth_impl';
1819
import { StsTokenManager } from '../src/core/user/token_manager';
1920
import { UserImpl } from '../src/core/user/user_impl';
2021
import { Auth } from '../src/model/auth';
2122
import { User } from '../src/model/user';
2223

2324
export const TEST_HOST = 'localhost';
2425
export const TEST_TOKEN_HOST = 'localhost/token';
26+
export const TEST_AUTH_DOMAIN = 'localhost';
2527
export const TEST_SCHEME = 'mock';
2628
export const TEST_KEY = 'test-api-key';
2729

28-
export const mockAuth: Auth = ({
29-
name: 'test-app',
30-
config: {
30+
export const mockAuth: Auth = new AuthImpl(
31+
'test-app',
32+
{
3133
apiKey: TEST_KEY,
34+
authDomain: TEST_AUTH_DOMAIN,
3235
apiHost: TEST_HOST,
3336
apiScheme: TEST_SCHEME,
3437
tokenApiHost: TEST_TOKEN_HOST,
3538
sdkClientVersion: 'testSDK/0.0.0'
3639
},
37-
_isInitialized: true,
38-
currentUser: null,
39-
async setPersistence() {},
40-
async updateCurrentUser() {},
41-
async signOut() {},
42-
onAuthStateChanged() {
43-
return () => {};
44-
},
45-
onIdTokenChanged() {
46-
return () => {};
47-
},
48-
_notifyStateListeners() {}
49-
} as unknown) as Auth;
40+
[],
41+
);
5042

5143
export function testUser(
5244
uid: string,

0 commit comments

Comments
 (0)