Skip to content

Commit 43c8261

Browse files
committed
added a few unit test cases for registerAuth
1 parent e0c00a9 commit 43c8261

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

.changeset/small-chairs-explain.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
'@firebase/auth': minor
2+
'@firebase/auth': patch
33
---
44

55
Allow port numbers in authDomain
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/**
2+
* @license
3+
* Copyright 2023 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
import { expect, use } from 'chai';
18+
import chaiAsPromised from 'chai-as-promised';
19+
import sinonChai from 'sinon-chai';
20+
import { FirebaseError } from '@firebase/util';
21+
import { registerAuth } from './register';
22+
import { ClientPlatform } from '../util/version';
23+
use(sinonChai);
24+
use(chaiAsPromised);
25+
26+
describe('it should register successfully for each platform type', () => {
27+
it('should not throw error for node platform', () => {
28+
expect(() => {
29+
registerAuth(ClientPlatform.NODE);
30+
}).to.not.throw(FirebaseError);
31+
});
32+
33+
it('should not throw error for browser platform', () => {
34+
expect(() => {
35+
registerAuth(ClientPlatform.BROWSER);
36+
}).to.not.throw(FirebaseError);
37+
});
38+
39+
it('should not throw error for react native platform', () => {
40+
expect(() => {
41+
registerAuth(ClientPlatform.REACT_NATIVE);
42+
}).to.not.throw(FirebaseError);
43+
});
44+
45+
it('should not throw error for worker platform', () => {
46+
expect(() => {
47+
registerAuth(ClientPlatform.WORKER);
48+
}).to.not.throw(FirebaseError);
49+
});
50+
});

0 commit comments

Comments
 (0)