File

src/utils/TestUtils.ts

Index

Methods

Methods

Static createSpyObj
createSpyObj(_baseName: string, methodNames: string[])

Method that creates a mock object with multiple spies.

Parameters :
Name Type Optional Description
_baseName string No
methodNames string[] No

collection of the spy's method names as a array of strings.

Returns : literal type

a created object with the spy methods as properties.

Static getWebMapServiceStub
getWebMapServiceStub(serviceModel: any, itemsToFetch?: any, postResult?: any, customServiceFunction?: any)

Returns a new mock instance of the WebMapService.

Parameters :
Name Type Optional Description
serviceModel any No

The mock service that contains the available models.

itemsToFetch any Yes

The items that should be returned when calling fetch().

postResult any Yes

The expected result when calling post().

customServiceFunction any Yes
Returns : any
Static testEventWasCalled
testEventWasCalled(fixture: ComponentFixture<T>, emitter: EventEmitter<EventData>, name: string, selector: string, event?: any)
Type parameters :
  • T

Tests that the event emitter gets called when the source event of the given name is triggered,

Parameters :
Name Type Optional Description
fixture ComponentFixture<T> No

The fixture of the component,

emitter EventEmitter<EventData> No

The event emitter of the component.

name string No

The name of the source event of the original component.

selector string No

The css selector to identify the component inside the fixture.

event any Yes

The event object of the original component.

Returns : void
Static triggerHtmlEvent
triggerHtmlEvent(fixture: ComponentFixture<T>, name: string, selector: string, event?: any)
Type parameters :
  • T

Triggers the specified HTML event in the component specified by the selector

Parameters :
Name Type Optional Description
fixture ComponentFixture<T> No

The fixture of the component,

name string No

The name of the source event of the original component.

selector string No

The css selector to identify the component inside the fixture.

event any Yes

The event object of the original component.

Returns : void

results matching ""

    No results matching ""