<commit_before>import { AngularFireAuth, FirebaseAuthState } from 'angularfire2';

// Mock for this service
export class MockAngularFireAuth {

  userConfig: any[];

  constructor(private args: any[]) {
    this.userConfig = args;
  }

  public getAuth() {
    return createMockAuthState(this.userConfig);
  }

  public subscribe(onChangeCallback: Function): void {
    onChangeCallback(createMockAuthState(this.userConfig));
  }

  public login(): Promise<FirebaseAuthState> {
    return new Promise((resolve, reject) => {
      resolve(createMockAuthState(this.userConfig));
      reject('bar');
    });
  }
}

class MockFirebaseUser implements firebase.User {
  displayName: string;
  email: string;
  photoURL: string;
  providerId: string;
  uid: string;
  emailVerified: boolean;
  isAnonymous: boolean;
  providerData: (firebase.UserInfo)[];
  refreshToken: string;

  delete() { return null; }
  getToken() { return null; }
  link()  { return null; }
  linkWithPopup() { return null; }
  linkWithRedirect()  { return null; }
  reauthenticate() { return null; }
  reload() { return null; }
  sendEmailVerification() { return null; }
  unlink() { return null; }
  updateEmail() { return null; }
  updatePassword() { return null; }
  updateProfile() { return null; }
}

function createMockAuthState(config: any[]): any {
  const [ uid, email, displayName, provider ] = config;
  if (uid !== null) {
    return {
      uid,
      provider,
      auth: createUser(uid, email, displayName),
      displayName,
      email,
      photoURL: `http://my.photo.com/${email}.jpg`,
      providerId: 'some.provider',
      google: {
        displayName: '<NAME>',
        photoURL: `http://my.photo.com/${email}.jpg`,
      },
    };
  }

  return null;
}

function createUser(uid, email, displayName) {
  let user = new MockFirebaseUser();
  user.displayName = displayName;
  user.email = email;
  user.uid = uid;
  user.photoURL = `http://my.photo.com/${email}.jpg`;
  user.providerId = 'some.provider';
  return user;
}
<commit_msg>test(auth): Update mock firebase user to match interface<commit_after>import { AngularFireAuth, FirebaseAuthState } from 'angularfire2';

// Mock for this service
export class MockAngularFireAuth {

  userConfig: any[];

  constructor(private args: any[]) {
    this.userConfig = args;
  }

  public getAuth() {
    return createMockAuthState(this.userConfig);
  }

  public subscribe(onChangeCallback: Function): void {
    onChangeCallback(createMockAuthState(this.userConfig));
  }

  public login(): Promise<FirebaseAuthState> {
    return new Promise((resolve, reject) => {
      resolve(createMockAuthState(this.userConfig));
      reject('bar');
    });
  }
}

class MockFirebaseUser implements firebase.User {
  displayName: string;
  email: string;
  photoURL: string;
  providerId: string;
  uid: string;
  emailVerified: boolean;
  isAnonymous: boolean;
  providerData: (firebase.UserInfo)[];
  refreshToken: string;
  toJSON: Function;

  delete() { return null; }
  getToken() { return null; }
  link()  { return null; }
  linkWithPopup() { return null; }
  linkWithRedirect()  { return null; }
  reauthenticate() { return null; }
  reload() { return null; }
  sendEmailVerification() { return null; }
  unlink() { return null; }
  updateEmail() { return null; }
  updatePassword() { return null; }
  updateProfile() { return null; }
}

function createMockAuthState(config: any[]): any {
  const [ uid, email, displayName, provider ] = config;
  if (uid !== null) {
    return {
      uid,
      provider,
      auth: createUser(uid, email, displayName),
      displayName,
      email,
      photoURL: `http://my.photo.com/${email}.jpg`,
      providerId: 'some.provider',
      google: {
        displayName: '<NAME>',
        photoURL: `http://my.photo.com/${email}.jpg`,
      },
    };
  }

  return null;
}

function createUser(uid, email, displayName) {
  let user = new MockFirebaseUser();
  user.displayName = displayName;
  user.email = email;
  user.uid = uid;
  user.photoURL = `http://my.photo.com/${email}.jpg`;
  user.providerId = 'some.provider';
  return user;
}

{'fraction_non_alphanumeric': 0.13752122241086587, 'fraction_numerical': 0.00048508367693427115, 'mean_word_length': 3.5318681318681318, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1260000', 'n_tokens_mistral': 1295, 'n_tokens_neox': 1284, 'n_words': 305}