Blunderchips / bankan

When was the last time you saw a good to-do app?
https://blunderchips.github.io/bankan/
Other
0 stars 1 forks source link

AngularFireAuth causes unit tests to fail #3

Open Blunderchips opened 5 years ago

Blunderchips commented 5 years ago

Describe the bug AngularFireAuth causes Karma unit tests to fail.

To Reproduce Steps to reproduce the behaviour:

  1. run: ng test

Expected behaviour Pass all tests.

Desktop (please complete the following information):

Additional context

NullInjectorError: StaticInjectorError(DynamicTestModule)[AngularFireAuth]: 
  StaticInjectorError(Platform: core)[AngularFireAuth]: 
    NullInjectorError: No provider for AngularFireAuth!
error properties: Object({ ngTempTokenPath: null, ngTokenPath: [ Function ] })
    at <Jasmine>
    at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm5/core.js:1225:1)
    at resolveToken (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm5/core.js:1463:1)
    at tryResolveToken (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm5/core.js:1407:1)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm5/core.js:1311:1)
    at resolveToken (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm5/core.js:1463:1)
    at tryResolveToken (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm5/core.js:1407:1)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm5/core.js:1311:1)
    at resolveNgModuleDep (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm5/core.js:18446:1)
    at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm5/core.js:19135:1)
    at injectInjectorOnly (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm5/core.js:510:1)
tarkant commented 5 years ago

As I've read in some threads, you need to add a mock to be able to test it instead of the actual service :

I'm still trying to figure it out from my side though I'm new to unit tests haha.