Created
April 12, 2017 16:23
-
-
Save benjamincharity/3d25cd2c95b6ecffadb18c3d4dbbd80b to your computer and use it in GitHub Desktop.
Mock ActivatedRoute with params, data and snapshot.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
beforeEach(async(() => { | |
TestBed.configureTestingModule({ | |
imports: [ | |
MdToolbarModule, | |
], | |
providers: [ | |
{ | |
provide: Router, | |
useClass: MockRouter, | |
}, | |
{ | |
provide: ActivatedRoute, | |
useValue: { | |
data: { | |
subscribe: (fn: (value: Data) => void) => fn({ | |
company: COMPANY, | |
}), | |
}, | |
params: { | |
subscribe: (fn: (value: Params) => void) => fn({ | |
tab: 0, | |
}), | |
}, | |
snapshot: { | |
url: [ | |
{ | |
path: 'foo', | |
}, | |
{ | |
path: 'bar', | |
}, | |
{ | |
path: 'baz', | |
}, | |
], | |
}, | |
}, | |
}, | |
], | |
}) | |
.overrideComponent(ConversationsComponent, { | |
set: { | |
template: '', | |
} | |
}); | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! That's what I neded!