#AngularFire Mocking

9 messages · Page 1 of 1 (latest)

warm glen
#

You could encapsulate all your usages of angularfire into services, and mock those services in order to test your components. If you want to test the services themselves, I would use the Firebase emulator and avoid using mocks.

ivory mauve
warm glen
#

Not sure I can do more than what the documentation is saying.
What are you doing, precisely? What do you expect to happen? What happens instead?

ivory mauve
#

I really want to only have 1 jest config file ;o

#

I currently am using this jest config file to run all spec files that arent using the firebase emulator

module.exports = {
  preset: 'jest-preset-angular',
  setupFilesAfterEnv: ['<rootDir>/src/setup.jest.ts'],
  moduleNameMapper: {
    '^src/(.*)$': '<rootDir>/src/$1',
  },
  testPathIgnorePatterns: [
    '/node_modules/',
    '/.*\\.firestore\\.spec\\.ts$', // Ignore all firestore.spec.ts files
  ],
};

and I'm using this jest config file to run all the files that are using the firebase emulator

module.exports = {
  preset: 'ts-jest',
  testEnvironment: 'node',
  testMatch: ['**/*.firestore.spec.ts'],
};
warm glen
#

I don't use Jest.

ivory mauve
#

Ah