1
1
import { describe , expect , it } from 'vitest' ;
2
2
import { BaseAuth } from '../src/auth' ;
3
- import { EmulatorCredential } from '../src/credential' ;
4
3
import { FirebaseAuthError } from '../src/errors' ;
5
4
import type { EmulatorEnv , KeyStorer } from './../src/index' ;
6
- import { EmulatedSigner , FirebaseTokenGenerator , projectId , signInWithCustomToken } from './firebase-utils' ;
5
+ import {
6
+ EmulatedSigner ,
7
+ FirebaseTokenGenerator ,
8
+ NopCredential ,
9
+ projectId ,
10
+ signInWithCustomToken ,
11
+ } from './firebase-utils' ;
7
12
8
13
const env : EmulatorEnv = {
9
14
FIREBASE_AUTH_EMULATOR_HOST : 'localhost:9099' ,
@@ -25,7 +30,7 @@ describe('createSessionCookie()', () => {
25
30
26
31
it ( 'creates a valid Firebase session cookie' , async ( ) => {
27
32
const keyStorer = new InMemoryKeyStorer ( 'cache-key' ) ;
28
- const auth = new BaseAuth ( projectId , keyStorer , new EmulatorCredential ( ) ) ;
33
+ const auth = new BaseAuth ( projectId , keyStorer , new NopCredential ( ) ) ;
29
34
30
35
const signer = new EmulatedSigner ( ) ;
31
36
const tokenGenerator = new FirebaseTokenGenerator ( signer ) ;
@@ -63,7 +68,7 @@ describe('createSessionCookie()', () => {
63
68
describe ( 'verifySessionCookie()' , ( ) => {
64
69
const uid = sessionCookieUids [ 0 ] ;
65
70
const keyStorer = new InMemoryKeyStorer ( 'cache-key' ) ;
66
- const auth = new BaseAuth ( projectId , keyStorer , new EmulatorCredential ( ) ) ;
71
+ const auth = new BaseAuth ( projectId , keyStorer , new NopCredential ( ) ) ;
67
72
it ( 'fails when called with an invalid session cookie' , async ( ) => {
68
73
await expect ( auth . verifySessionCookie ( 'invalid-token' ) ) . rejects . toThrowError ( FirebaseAuthError ) ;
69
74
} ) ;
0 commit comments