|
| 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 * as sinon from 'sinon'; |
| 20 | +import sinonChai from 'sinon-chai'; |
| 21 | + |
| 22 | +import { FirebaseApp } from '@firebase/app'; |
| 23 | +import { FirebaseError } from '@firebase/util'; |
| 24 | +import { registerAuth } from './register'; |
| 25 | +import { ClientPlatform } from '../util/version'; |
| 26 | +use(sinonChai); |
| 27 | +use(chaiAsPromised); |
| 28 | + |
| 29 | +describe('it should register successfully for each platform type', () => { |
| 30 | + it('should not throw error for node platform', () => { |
| 31 | + expect(() => { |
| 32 | + registerAuth(ClientPlatform.NODE); |
| 33 | + }).to.not.throw(FirebaseError); |
| 34 | + }); |
| 35 | + |
| 36 | + it('should not throw error for browser platform', () => { |
| 37 | + expect(() => { |
| 38 | + registerAuth(ClientPlatform.BROWSER); |
| 39 | + }).to.not.throw(FirebaseError); |
| 40 | + }); |
| 41 | + |
| 42 | + it('should not throw error for react native platform', () => { |
| 43 | + expect(() => { |
| 44 | + registerAuth(ClientPlatform.REACT_NATIVE); |
| 45 | + }).to.not.throw(FirebaseError); |
| 46 | + }); |
| 47 | + |
| 48 | + it('should not throw error for worker platform', () => { |
| 49 | + expect(() => { |
| 50 | + registerAuth(ClientPlatform.WORKER); |
| 51 | + }).to.not.throw(FirebaseError); |
| 52 | + }); |
| 53 | +}); |
0 commit comments