Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

TestBed.overrideProvider isn't override authService #557

Open
mohamedaboelmagd opened this issue Oct 30, 2019 · 0 comments
Open

TestBed.overrideProvider isn't override authService #557

mohamedaboelmagd opened this issue Oct 30, 2019 · 0 comments

Comments

@mohamedaboelmagd
Copy link

mohamedaboelmagd commented Oct 30, 2019

https://stackoverflow.com/questions/58622486/testbed-overrideprovider-isnt-override-service-in-effect-ts link question on stackoverflow

class MockAuthService {
  currentUser = of(fromSeeds.userAuth);
}
describe('AuthEffects', () => {
  ...
  let authService: AuthService;

beforeEach(async () => {
   TestBed.configureTestingModule({
   ......,
  { provide: AuthService,  useClass: MockAuthService },
  ...
  })
})

 describe('listen$', () => {
    beforeEach(async () => {
       TestBed.overrideProvider(authService.currentUser, {
         useValue: of({ ...fromSeeds.userAuth, emailVerified: false })
       });
    });
    it('should', () => {
     // test here
    })
  });
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant