message: feat: switching between test sdk and real sdk depending upon env and not using auth when in test
diff: @@ -3,10 +3,28 @@ import { EventContext } from 'firebase-functions/lib/cloud-functions';
  import { DocumentSnapshot } from 'firebase-functions/lib/providers/firestore';
  import { IUser, User } from '../models/users';
  import * as admin from 'firebase-admin';
  +import * as firebaseTest from '@firebase/testing';
  +const projectId = 'reach-4-help-test';
  +
  +let db: any = undefined;
  +let auth: any = undefined;
  +let test = true;
  +
  +if(process.env.FIREBASE_CONFIG){
  + let config = JSON.parse(process.env.FIREBASE_CONFIG);
  + if(config.databaseURL && config.databaseURL !== 'undefined'){
  admin.initializeApp();
  -const db = admin.firestore();
  -const auth = admin.auth();
  + db = admin.firestore();
  + auth = admin.auth();
  + test = false;
  + }
  +}
  +
  +if(test){
  + db = firebaseTest.initializeAdminApp({ projectId }).firestore();
  +}
  +
  export const validateUser = (value: IUser): Promise<void> => {
  return validateOrReject(User.factory(value)).then(() => {
  @@ -15,11 +33,19 @@ export const validateUser = (value: IUser): Promise<void> => {
  };
  export const setIsUserPin = (userId: string, status: boolean): Promise<void> => {
  + if(test){
  + return Promise.resolve();
  + }else{
  return auth.setCustomUserClaims(userId, { pin: status });
  + }
  };
  export const setIsUserCav = (userId: string, status: boolean): Promise<void> => {
  + if(test){
  + return Promise.resolve();
  + }else{
  return auth.setCustomUserClaims(userId, { cav: status });
  + }
  };
  export const onCreate = (snapshot: DocumentSnapshot, context: EventContext) => {
  