Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to base a CI run of of commit a89e05b #7796

Closed
wants to merge 14 commits into from
2 changes: 1 addition & 1 deletion packages/auth-compat/test/integration/flows/custom.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {

use(chaiAsPromised);

describe('Integration test: custom auth', () => {
describe('Integration test: custom auth compat', () => {
let customToken: string;
let uid: string;

Expand Down
30 changes: 15 additions & 15 deletions packages/auth-compat/test/integration/flows/email.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { UserCredential } from '@firebase/auth-types';

use(chaiAsPromised);

describe('Integration test: email/password auth', () => {
describe('Integration test: email/password auth compat', () => {
let email: string;
beforeEach(() => {
initializeTestInstance();
Expand All @@ -38,7 +38,7 @@ describe('Integration test: email/password auth', () => {

afterEach(() => cleanUpTestInstance());

it('allows user to sign up', async () => {
/*it('allows user to sign up', async () => {
const userCred = await firebase
.auth()
.createUserWithEmailAndPassword(email, 'password');
Expand All @@ -57,14 +57,14 @@ describe('Integration test: email/password auth', () => {
const additionalUserInfo = userCred.additionalUserInfo!;
expect(additionalUserInfo.isNewUser).to.be.true;
expect(additionalUserInfo.providerId).to.eq('password');
});
});*/

it('errors when createUser called twice', async () => {
/*it('errors when createUser called twice', async () => {
await firebase.auth().createUserWithEmailAndPassword(email, 'password');
await expect(
firebase.auth().createUserWithEmailAndPassword(email, 'password')
).to.be.rejectedWith(FirebaseError, 'auth/email-already-in-use');
});
});*/

context('with existing user', () => {
let signUpCred: UserCredential;
Expand All @@ -76,7 +76,7 @@ describe('Integration test: email/password auth', () => {
await firebase.auth().signOut();
});

it('allows the user to sign in with signInWithEmailAndPassword', async () => {
/*it('allows the user to sign in with signInWithEmailAndPassword', async () => {
const signInCred = await firebase
.auth()
.signInWithEmailAndPassword(email, 'password');
Expand All @@ -87,9 +87,9 @@ describe('Integration test: email/password auth', () => {
const additionalUserInfo = signInCred.additionalUserInfo!;
expect(additionalUserInfo.isNewUser).to.be.false;
expect(additionalUserInfo.providerId).to.eq('password');
});
});*/

it('allows the user to sign in with signInWithCredential', async () => {
/*it('allows the user to sign in with signInWithCredential', async () => {
const credential = firebase.auth.EmailAuthProvider.credential(
email,
'password'
Expand All @@ -102,9 +102,9 @@ describe('Integration test: email/password auth', () => {
const additionalUserInfo = signInCred.additionalUserInfo!;
expect(additionalUserInfo.isNewUser).to.be.false;
expect(additionalUserInfo.providerId).to.eq('password');
});
});*/

it('allows the user to update profile', async () => {
/*it('allows the user to update profile', async () => {
let { user } = await firebase
.auth()
.signInWithEmailAndPassword(email, 'password');
Expand All @@ -122,9 +122,9 @@ describe('Integration test: email/password auth', () => {
).user;
expect(user!.displayName).to.eq('Display Name');
expect(user!.photoURL).to.eq('photo-url');
});
});*/

it('allows the user to delete the account', async () => {
/*it('allows the user to delete the account', async () => {
const { user } = await firebase
.auth()
.signInWithEmailAndPassword(email, 'password');
Expand All @@ -139,16 +139,16 @@ describe('Integration test: email/password auth', () => {
await expect(
firebase.auth().signInWithEmailAndPassword(email, 'password')
).to.be.rejectedWith(FirebaseError, 'auth/user-not-found');
});
});*/

it('sign in can be called twice successively', async () => {
/*it('sign in can be called twice successively', async () => {
const { user: userA } = await firebase
.auth()
.signInWithEmailAndPassword(email, 'password');
const { user: userB } = await firebase
.auth()
.signInWithEmailAndPassword(email, 'password');
expect(userA!.uid).to.eq(userB!.uid);
});
});*/
});
});
4 changes: 2 additions & 2 deletions packages/auth-compat/test/integration/flows/oob.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('Integration test: oob codes', () => {
return code(toEmail);
}

it('allows user to sign in', async () => {
/*it('allows user to sign in', async () => {
const { user, operationType } = await firebase
.auth()
.signInWithEmailLink(email, oobSession.oobLink);
Expand Down Expand Up @@ -183,7 +183,7 @@ describe('Integration test: oob codes', () => {
expect(firebase.auth().currentUser).to.eq(linked);
expect(linked!.email).to.eq(email);
expect(linked!.emailVerified).to.be.true;
});
});*/

it('can be linked to a custom token', async () => {
const { user: original } = await firebase.auth().signInWithCustomToken(
Expand Down
30 changes: 15 additions & 15 deletions packages/auth-compat/test/integration/flows/phone.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ describe('Integration test: phone auth', () => {
return codes[vid].code;
}

it('allows user to sign up', async () => {
/*it('allows user to sign up', async () => {
const cr = await firebase
.auth()
.signInWithPhoneNumber(PHONE_A.phoneNumber, verifier);
Expand All @@ -94,9 +94,9 @@ describe('Integration test: phone auth', () => {
expect(user!.isAnonymous).to.be.false;
expect(user!.uid).to.be.a('string');
expect(user!.phoneNumber).to.eq(PHONE_A.phoneNumber);
});
});*/

it('anonymous users can link (and unlink) phone number', async () => {
/*it('anonymous users can link (and unlink) phone number', async () => {
const { user } = await firebase.auth().signInAnonymously();
const { uid: anonId } = user!;

Expand All @@ -111,9 +111,9 @@ describe('Integration test: phone auth', () => {
// Is anonymous stays false even after unlinking
expect(firebase.auth().currentUser!.isAnonymous).to.be.false;
expect(firebase.auth().currentUser!.phoneNumber).to.be.null;
});
});*/

it('anonymous users can upgrade using phone number', async () => {
/*it('anonymous users can upgrade using phone number', async () => {
const { user } = await firebase.auth().signInAnonymously();
const { uid: anonId } = user!;

Expand Down Expand Up @@ -144,9 +144,9 @@ describe('Integration test: phone auth', () => {
PHONE_B.phoneNumber
);
expect(secondSignIn!.providerData[0]!.providerId).to.eq('phone');
});
});*/

context('with already-created user', () => {
context('with already-created user compat', () => {
let signUpCred: UserCredential;

beforeEach(async () => {
Expand All @@ -158,16 +158,16 @@ describe('Integration test: phone auth', () => {
await firebase.auth().signOut();
});

it('allows the user to sign in again', async () => {
/*it('allows the user to sign in again', async () => {
const cr = await firebase
.auth()
.signInWithPhoneNumber(PHONE_A.phoneNumber, verifier);
const signInCred = await cr.confirm(await code(cr));

expect(signInCred.user!.uid).to.eq(signUpCred.user!.uid);
});
});*/

it('allows the user to update their phone number', async () => {
/*it('allows the user to update their phone number', async () => {
let cr = await firebase
.auth()
.signInWithPhoneNumber(PHONE_A.phoneNumber, verifier);
Expand Down Expand Up @@ -197,9 +197,9 @@ describe('Integration test: phone auth', () => {
.signInWithPhoneNumber(PHONE_B.phoneNumber, verifier);
const { user: secondSignIn } = await cr.confirm(await code(cr));
expect(secondSignIn!.uid).to.eq(user!.uid);
});
});*/

it('allows the user to reauthenticate with phone number', async () => {
/*it('allows the user to reauthenticate with phone number', async () => {
let cr = await firebase
.auth()
.signInWithPhoneNumber(PHONE_A.phoneNumber, verifier);
Expand All @@ -220,9 +220,9 @@ describe('Integration test: phone auth', () => {
await cr.confirm(await code(cr));

expect(await user!.getIdToken()).not.to.eq(oldToken);
});
});*/

it('prevents reauthentication with wrong phone number', async () => {
/*it('prevents reauthentication with wrong phone number', async () => {
let cr = await firebase
.auth()
.signInWithPhoneNumber(PHONE_A.phoneNumber, verifier);
Expand All @@ -247,6 +247,6 @@ describe('Integration test: phone auth', () => {
.signInWithPhoneNumber(PHONE_B.phoneNumber, verifier);
const { user: otherUser } = await cr.confirm(await code(cr));
await otherUser!.delete();
});
});*/
});
});
1 change: 1 addition & 0 deletions packages/auth/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/**
*
* Firebase Authentication
*
* @packageDocumentation
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/test/integration/flows/email.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { generateMiddlewareTests } from './middleware_test_generator';

use(chaiAsPromised);

describe('Integration test: email/password auth', () => {
describe('Integration test: email/password auth mod', () => {
let auth: Auth;
let email: string;
let password: string;
Expand Down
45 changes: 23 additions & 22 deletions packages/auth/test/integration/flows/middleware_test_generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,26 @@
* limitations under the License.
*/

import { expect, use } from 'chai';

Check failure on line 18 in packages/auth/test/integration/flows/middleware_test_generator.ts

View workflow job for this annotation

GitHub Actions / Lint

'expect' is defined but never used

Check failure on line 18 in packages/auth/test/integration/flows/middleware_test_generator.ts

View workflow job for this annotation

GitHub Actions / Lint

'expect' is defined but never used. Allowed unused vars must match /^_/u
import chaiAsPromised from 'chai-as-promised';
import * as sinon from 'sinon';
//import * as sinon from 'sinon';
import sinonChai from 'sinon-chai';

// eslint-disable-next-line import/no-extraneous-dependencies
import { Auth, createUserWithEmailAndPassword, User } from '@firebase/auth';

Check failure on line 24 in packages/auth/test/integration/flows/middleware_test_generator.ts

View workflow job for this annotation

GitHub Actions / Lint

'createUserWithEmailAndPassword' is defined but never used

Check failure on line 24 in packages/auth/test/integration/flows/middleware_test_generator.ts

View workflow job for this annotation

GitHub Actions / Lint

'createUserWithEmailAndPassword' is defined but never used. Allowed unused vars must match /^_/u
import { randomEmail } from '../../helpers/integration/helpers';

Check failure on line 25 in packages/auth/test/integration/flows/middleware_test_generator.ts

View workflow job for this annotation

GitHub Actions / Lint

'randomEmail' is defined but never used

Check failure on line 25 in packages/auth/test/integration/flows/middleware_test_generator.ts

View workflow job for this annotation

GitHub Actions / Lint

'randomEmail' is defined but never used. Allowed unused vars must match /^_/u

use(chaiAsPromised);
use(sinonChai);

export function generateMiddlewareTests(
authGetter: () => Auth,
signIn: () => Promise<unknown>

Check failure on line 32 in packages/auth/test/integration/flows/middleware_test_generator.ts

View workflow job for this annotation

GitHub Actions / Lint

'signIn' is defined but never used. Allowed unused args must match /^_/u
): void {
context('middleware', () => {
let auth: Auth;
let unsubscribes: Array<() => void>;
let password: string;

Check failure on line 37 in packages/auth/test/integration/flows/middleware_test_generator.ts

View workflow job for this annotation

GitHub Actions / Lint

'password' is assigned a value but never used. Allowed unused vars must match /^_/u

beforeEach(() => {
auth = authGetter();
Expand All @@ -55,14 +55,14 @@
* automatically unsubscribe after every test (since some tests may
* perform cleanup after that would be affected by the middleware)
*/
function beforeAuthStateChanged(

Check failure on line 58 in packages/auth/test/integration/flows/middleware_test_generator.ts

View workflow job for this annotation

GitHub Actions / Lint

'beforeAuthStateChanged' is defined but never used. Allowed unused vars must match /^_/u
callback: (user: User | null) => void | Promise<void>,
onAbort?: () => void
): void {
unsubscribes.push(auth.beforeAuthStateChanged(callback, onAbort));
}

it('can prevent user sign in', async () => {
/*it('can prevent user sign in', async () => {
beforeAuthStateChanged(() => {
throw new Error('stop sign in');
});
Expand All @@ -78,9 +78,9 @@

await expect(signIn()).to.be.rejectedWith('auth/login-blocked');
expect(auth.currentUser).to.be.null;
});
});*/

it('keeps previously-logged in user if blocked', async () => {
/*it('keeps previously-logged in user if blocked', async () => {
// Use a random email/password sign in for the base user
const { user: baseUser } = await createUserWithEmailAndPassword(
auth,
Expand All @@ -94,27 +94,27 @@

await expect(signIn()).to.be.rejectedWith('auth/login-blocked');
expect(auth.currentUser).to.eq(baseUser);
});
});*/

it('can allow sign in', async () => {
/*it('can allow sign in', async () => {
beforeAuthStateChanged(() => {
// Pass
});

await expect(signIn()).not.to.be.rejected;
expect(auth.currentUser).not.to.be.null;
});
});*/

it('can allow sign in as a promise', async () => {
/* it('can allow sign in as a promise', async () => {
beforeAuthStateChanged(() => {
return Promise.resolve();
});

await expect(signIn()).not.to.be.rejected;
expect(auth.currentUser).not.to.be.null;
});
});*/

it('overrides previous user if allowed', async () => {
/*it('overrides previous user if allowed', async () => {
// Use a random email/password sign in for the base user
const { user: baseUser } = await createUserWithEmailAndPassword(
auth,
Expand All @@ -128,9 +128,9 @@

await expect(signIn()).not.to.be.rejected;
expect(auth.currentUser).not.to.eq(baseUser);
});
});*/

it('will reject if one callback fails', async () => {
/*it('will reject if one callback fails', async () => {
// Also check that the function is called multiple
// times
const spy = sinon.spy();
Expand All @@ -145,9 +145,9 @@
await expect(signIn()).to.be.rejectedWith('auth/login-blocked');
expect(auth.currentUser).to.be.null;
expect(spy).to.have.been.calledThrice;
});
});*/

it('keeps previously-logged in user if one rejects', async () => {
/*it('keeps previously-logged in user if one rejects', async () => {
// Use a random email/password sign in for the base user
const { user: baseUser } = await createUserWithEmailAndPassword(
auth,
Expand All @@ -169,9 +169,9 @@
await expect(signIn()).to.be.rejectedWith('auth/login-blocked');
expect(auth.currentUser).to.eq(baseUser);
expect(spy).to.have.been.calledThrice;
});
});*/

it('allows sign in with multiple callbacks all pass', async () => {
/*it('allows sign in with multiple callbacks all pass', async () => {
// Use a random email/password sign in for the base user
const { user: baseUser } = await createUserWithEmailAndPassword(
auth,
Expand All @@ -190,9 +190,9 @@
await expect(signIn()).not.to.be.rejected;
expect(auth.currentUser).not.to.eq(baseUser);
expect(spy).to.have.been.calledThrice;
});
});*/

it('does not call subsequent callbacks after rejection', async () => {
/*it('does not call subsequent callbacks after rejection', async () => {
const firstSpy = sinon.spy();
const secondSpy = sinon.spy();

Expand All @@ -205,9 +205,9 @@
await expect(signIn()).to.be.rejectedWith('auth/login-blocked');
expect(firstSpy).to.have.been.calledOnce;
expect(secondSpy).not.to.have.been.called;
});
});*/

it('can prevent sign-out', async () => {
/*it('can prevent sign-out', async () => {
await signIn();
const user = auth.currentUser;

Expand All @@ -217,9 +217,9 @@

await expect(auth.signOut()).to.be.rejectedWith('auth/login-blocked');
expect(auth.currentUser).to.eq(user);
});
});*/

it('calls onAbort after rejection', async () => {
/*it('calls onAbort after rejection', async () => {
const onAbort = sinon.spy();
beforeAuthStateChanged(() => {
// Pass
Expand All @@ -231,5 +231,6 @@
await expect(signIn()).to.be.rejectedWith('auth/login-blocked');
expect(onAbort).to.have.been.called;
});
*/
});
}
Loading
Loading