import {ArrayListAdapter} from '@serenity-js/core/lib/screenplay/questions/lists'
public class | source

ArrayListAdapter

Adapts an Array so that it can be used with List

Implements:

Constructor Summary

Public Constructor
public

constructor(array: Answerable<Item_Type[]>)

Method Summary

Public Methods
public

count(actor: AnswersQuestions & UsesAbilities): Promise<number>

Returns the number of items the underlying Array contains, left after applying any filters.

public

first(actor: AnswersQuestions & UsesAbilities): Promise<Item_Type>

Returns the first of items the underlying Array contains, left after applying any filters.

public

get(actor: AnswersQuestions & UsesAbilities, index: number): Promise<Item_Type>

Returns the nth of items the underlying Array contains, left after applying any filters.

public

items(actor: AnswersQuestions & UsesAbilities): Promise<number>

Returns the underlying Array, with any filters applied.

public

last(actor: AnswersQuestions & UsesAbilities): Promise<Item_Type>

Returns the last of items the underlying Array contains, left after applying any filters.

public

toString(): string

Returns a human-readable description of the underlying Array.

public

withFilter(question: MetaQuestion<Item_Type, Promise<Answer_Type>|Answer_Type>, expectation: Expectation<any, Answer_Type>): ListAdapter<Item_Type, Item_Type[], Promise<Item_Type>, Promise<Item_Type[]>>

Filters the underlying Array so that the result contains only those items that meet the Expectation

Public Constructors

public constructor(array: Answerable<Item_Type[]>) source

Params:

NameTypeAttributeDescription
array Answerable<Item_Type[]>

Public Methods

public count(actor: AnswersQuestions & UsesAbilities): Promise<number> source

Returns the number of items the underlying Array contains, left after applying any filters.

Params:

NameTypeAttributeDescription
actor AnswersQuestions & UsesAbilities

Returns:

Promise<number>

public first(actor: AnswersQuestions & UsesAbilities): Promise<Item_Type> source

Returns the first of items the underlying Array contains, left after applying any filters.

Params:

NameTypeAttributeDescription
actor AnswersQuestions & UsesAbilities

Returns:

Promise<Item_Type>

public get(actor: AnswersQuestions & UsesAbilities, index: number): Promise<Item_Type> source

Returns the nth of items the underlying Array contains, left after applying any filters.

Params:

NameTypeAttributeDescription
actor AnswersQuestions & UsesAbilities
index number

Zero-based index of the item to return

Returns:

Promise<Item_Type>

public items(actor: AnswersQuestions & UsesAbilities): Promise<number> source

Returns the underlying Array, with any filters applied.

Params:

NameTypeAttributeDescription
actor AnswersQuestions & UsesAbilities

Returns:

Promise<number>

public last(actor: AnswersQuestions & UsesAbilities): Promise<Item_Type> source

Returns the last of items the underlying Array contains, left after applying any filters.

Params:

NameTypeAttributeDescription
actor AnswersQuestions & UsesAbilities

Returns:

Promise<Item_Type>

public toString(): string source

Returns a human-readable description of the underlying Array.

Returns:

string

public withFilter(question: MetaQuestion<Item_Type, Promise<Answer_Type>|Answer_Type>, expectation: Expectation<any, Answer_Type>): ListAdapter<Item_Type, Item_Type[], Promise<Item_Type>, Promise<Item_Type[]>> source

Filters the underlying Array so that the result contains only those items that meet the Expectation

Params:

NameTypeAttributeDescription
question MetaQuestion<Item_Type, Promise<Answer_Type>|Answer_Type>
expectation Expectation<any, Answer_Type>

Returns:

ListAdapter<Item_Type, Item_Type[], Promise<Item_Type>, Promise<Item_Type[]>>