File tree 4 files changed +28
-25
lines changed
4 files changed +28
-25
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,8 @@ import { Endpoint } from '..';
22
22
import { ServerError } from '../errors' ;
23
23
import { FirebaseError } from '@firebase/util' ;
24
24
import * as mockFetch from '../../../test/mock_fetch' ;
25
- import { mockEndpoint , mockAuth } from '../../../test/api/helper' ;
25
+ import { mockEndpoint } from '../../../test/api/helper' ;
26
+ import { mockAuth } from '../../../test/mock_auth' ;
26
27
27
28
use ( chaiAsPromised ) ;
28
29
Original file line number Diff line number Diff line change 18
18
import { expect , use } from 'chai' ;
19
19
import * as chaiAsPromised from 'chai-as-promised' ;
20
20
import { UserImpl } from './user_impl' ;
21
- import { mockAuth } from '../../../test/mock_auth' ;
22
21
import { StsTokenManager } from './token_manager' ;
23
22
import { IdTokenResponse } from '../../model/id_token' ;
23
+ import { mockAuth } from '../../../test/mock_auth' ;
24
24
25
25
use ( chaiAsPromised ) ;
26
26
27
27
describe ( 'core/user/user_impl' , ( ) => {
28
- const auth = mockAuth ( 'foo' , 'i-am-the-api-key' ) ;
28
+ const auth = mockAuth ;
29
29
let stsTokenManager : StsTokenManager ;
30
30
31
31
beforeEach ( ( ) => {
Original file line number Diff line number Diff line change 15
15
* limitations under the License.
16
16
*/
17
17
18
- import { Auth } from '../../src/model/auth' ;
19
18
import { Endpoint } from '../../src/api' ;
20
19
import { mock , Route } from '../mock_fetch' ;
21
-
22
- const TEST_HOST = 'localhost' ;
23
- const TEST_SCHEME = 'mock' ;
24
- const TEST_KEY = 'test-api-key' ;
25
-
26
- export const mockAuth : Auth = {
27
- name : 'test-app' ,
28
- config : {
29
- apiKey : 'test-api-key' ,
30
- apiHost : TEST_HOST ,
31
- apiScheme : TEST_SCHEME
32
- }
33
- } ;
20
+ import { TEST_SCHEME , TEST_HOST , TEST_KEY } from '../mock_auth' ;
34
21
35
22
export function mockEndpoint (
36
23
endpoint : Endpoint ,
Original file line number Diff line number Diff line change 15
15
* limitations under the License.
16
16
*/
17
17
18
- import { AppName , ApiKey , Auth } from '../src/model/auth' ;
18
+ import { Auth } from '../src/model/auth' ;
19
+ import { User } from '../src/model/user' ;
20
+ import { UserImpl } from '../src/core/user/user_impl' ;
21
+ import { StsTokenManager } from '../src/core/user/token_manager' ;
19
22
20
- export function mockAuth ( name : AppName , apiKey : ApiKey ) : Auth {
21
- return {
22
- name,
23
- config : {
24
- apiKey
25
- }
26
- } ;
23
+ export const TEST_HOST = 'localhost' ;
24
+ export const TEST_SCHEME = 'mock' ;
25
+ export const TEST_KEY = 'test-api-key' ;
26
+
27
+ export const mockAuth : Auth = {
28
+ name : 'test-app' ,
29
+ config : {
30
+ apiKey : TEST_KEY ,
31
+ apiHost : TEST_HOST ,
32
+ apiScheme : TEST_SCHEME
33
+ }
34
+ } ;
35
+
36
+ export function testUser ( uid : string ) : User {
37
+ return new UserImpl ( {
38
+ uid,
39
+ auth : mockAuth ,
40
+ stsTokenManager : new StsTokenManager ( )
41
+ } ) ;
27
42
}
You can’t perform that action at this time.
0 commit comments