UNPKG

@opra/testing

Version:
39 lines (38 loc) 1.34 kB
import { OpraFilter } from '@opra/common'; import { ApiExpectBase } from './api-expect-base.js'; export declare class ApiExpectCollection extends ApiExpectBase { get not(): ApiExpectCollection; /** * Tests if Collection have number of items in payload * @param min Minimum number of items. Default 1 * @param max Maximum number of items */ toReturnItems(min?: number, max?: number): this; toContainTotalMatches(min?: number, max?: number): this; /** * Tests if Collection items matches given object * @param expected */ toMatch<T extends {}>(expected: T): this; /** * Tests if Collection items has all of provided fields. * @param fields */ toContainFields(fields: string | string[]): this; /** * Tests if Collection items only contains all of provided fields. * @param fields */ toContainAllFields(fields: string | string[]): this; /** * Tests if Collection is sorted by given field(s). * @param fields */ toBeSortedBy(fields: string | string[]): this; /** * Tests if Collection is filtered by given condition. * @param filter */ toBeFilteredBy(filter: string | OpraFilter.Expression): this; } export declare function convertFilter(str: string | OpraFilter.Expression | undefined): any;