Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

viewDidLeave not subscribable #50

Open
rob-moore opened this issue Mar 13, 2018 · 0 comments
Open

viewDidLeave not subscribable #50

rob-moore opened this issue Mar 13, 2018 · 0 comments

Comments

@rob-moore
Copy link

rob-moore commented Mar 13, 2018

Hey I'm working on getting tests up and running for a service that I wrote that uses the App in the constructor.

constructor(public appCtrl: App) {
		this.appCtrl.viewDidLeave.subscribe(view => {
			this.updateHistory(view);
		});
	}

Here's the constructor for the class that I'm testing and here is my test:

describe('tab service', () => {
	let tabSvc: TabService;
	let app: App;

	beforeEach(() => {
		app = AppMock.instance();

		TestBed.configureTestingModule({
			providers: [
				TabService,
			]
		});
		tabSvc = new TabService(app);
	});

	it('should have a updatehistoy method', () => {
		expect(tabSvc.updateHistory).toBe(true);
	});
});

Every time I run the test it seems like it gets to the constructor of my service then it fails with this error:

TypeError: this.appCtrl.viewDidLeave.subscribe is not a function

Any ideas on what's going on here? I looked at the code and it looks like viewDidLeave is available on your AppMock and should always be an Observable. Any idea why I can't subscribe to it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant