Index

src/lib/mock.ts

collectMethodNames
collectMethodNames(proto)
Parameters :
Name Optional
proto No
Returns : Array<string>
createMock
createMock(type: Type)

Creates a spy object for a class where all the methods of the class (and of its superclasses) are spies. I.e., for a class UserService with methods get(), create(), update() and delete(), calling createMock(UserService) is equivalent to calling jasmine.createSpyObj<UserService>('UserService', ['get', 'create', 'update', 'delete']).

Parameters :
Name Type Optional Description
type Type No

the type to mock (usually a service class)

Returns : jasmine.SpyObj<T>

src/lib/route.ts

fakeRoute
favor stubRoute, which creates an easier to use and more logical stub
fakeRoute(options)

Creates a fake partial ActivatedRoute for tests.

If you pass params, then the created route's paramMap will contain the same values. The same goes for queryParams and queryParamMap.

If you pass a parent route and a snapshot, and the passed snapshot doesn't have a parent, then the snapshot's parent will be set to the parent route snapshot. This allows the code under test to use route.parent.snapshot or route.snapshot.parent.

If you pass a snapshot with a parent, but don't pass a parent or pass a parent without snapshot, then the route's parent snapshot will be set to the given snapshot's parent. This allows the code under test to use route.parent.snapshot or route.snapshot.parent.

Parameters :
Name Optional
options No
Returns : ActivatedRoute

a partially populated, fake ActivatedRoute, depending on what you passed in

fakeSnapshot
favor stubRoute, which creates an easier to use and more logical stub for both the route and its snapshot
fakeSnapshot(options)

Creates a fake partial ActivatedRouteSnapshot for tests.

If you pass params, then the created snapshot's paramMap will contain the same values. The same goes for queryParams and queryParamMap.

Parameters :
Name Optional
options No
Returns : ActivatedRouteSnapshot

a partially populated, fake ActivatedRoute, depending on what you passed in

stubRoute
stubRoute(options?: ActivatedRouteStubOptions)

Creates a new ActivatedRouteStub, by calling its constructor.

Parameters :
Name Type Optional
options ActivatedRouteStubOptions Yes
Returns : ActivatedRouteStub

results matching ""

    No results matching ""