How to use firebase-functions-test - 4 common examples

To help you get started, we’ve selected a few firebase-functions-test examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tsirlucas / PayIt / functions / src / onBillChange.spec.ts View on Github external
describe('onBillChange', () => {
  const testHelper = test();

  // Mock change snapshots

  const beforeSnap = testHelper.firestore.makeDocumentSnapshot(mockedBill, 'bills/ID');

  const snap = testHelper.firestore.makeDocumentSnapshot(mockedUpdatedBill, 'bills/ID');

  // Mock needed data
  const mockedUserAndPendencies = {
    user: mockedUpdatedUser,
    pendencies: {
      id: 'UID',
      data: {
        [pendencyKey]: mockedPendency,
      },
    },
github tsirlucas / PayIt / functions / src / sendPendenciesAlerts.spec.ts View on Github external
describe('sendPendenciesAlerts', () => {
  const testHelper = test();
  testHelper.mockConfig({cron: {key: 'cronKey'}});

  // // Mock needed data

  const mockedUserWithI18n = {
    ...mockedUser2,
    i18n: 'pt-BR',
  };

  const mockedUser3 = {
    uid: 'UID3',
  };

  const mockedUserPendency = {
    id: mockedUser.uid,
    data: {
github tsirlucas / PayIt / functions / src / updateAllPendencies.spec.ts View on Github external
describe('updateAllPendencies', () => {
  const testHelper = test();
  testHelper.mockConfig({cron: {key: 'cronKey'}});

  // // Mock needed data

  const mockedUserWOToken = {
    ...mockedUser2,
    fcmToken: null as string,
  };

  const mockedUserPendency = {
    id: mockedUser.uid,
    data: {
      [pendencyKey]: mockedPendency,
    },
  };
github tsirlucas / PayIt / functions / src / onPaydayChange.spec.ts View on Github external
describe('onPaydayChange', () => {
  const testHelper = test();

  // Mock change snapshots
  const beforeSnap = testHelper.firestore.makeDocumentSnapshot(mockedUser, 'users/UID');

  const snap = testHelper.firestore.makeDocumentSnapshot(mockedUpdatedUser, 'users/UID');

  // Mock needed data

  const mockedResultData = {
    [pendencyKey]: mockedPendency,
    [pendencyKey2]: mockedPendency2,
  };

  const mockedResult = {
    id: 'UID',
    data: mockedResultData,

firebase-functions-test

A testing companion to firebase-functions.

MIT
Latest version published 3 days ago

Package Health Score

85 / 100
Full package analysis

Popular firebase-functions-test functions