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

TestBed.overrideProvider isn't override authService #557

@mohamedaboelmagd

Description

@mohamedaboelmagd

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
    })
  });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions