60e2149072
Tasks 16-20: Online Board Tests (Search/Filter, Tabs, Flight List, Details Modal, Time/Date) - Task 16: Search & Filter tests (37 tests) - departure/arrival cities, passenger count, cabin class - Task 17: Arrival/Departure Tabs tests (45 tests) - tab switching, flight display, sorting - Task 18: Flight List View tests (50 tests) - display, sorting, filtering, pagination, loading states - Task 19: Flight Details Modal tests (40 tests) - opening/closing, content display, actions - Task 20: Time & Date Filter tests (43 tests) - date selection, time ranges, calendar navigation Tasks 21-25: Flight Details Tests (Flight Info, Passengers, Seats, Services, Fares) - Task 21: Flight Info Display tests (40 tests) - basic info, airports, route visualization, timeline - Task 22: Passenger Info tests (50 tests) - passenger list, details, services, special requirements - Task 23: Seat Selection tests (50 tests) - seat map, selection, categories, recommendations - Task 24: Service Selection tests (25 tests) - baggage, meals, seats, summary - Task 25: Fare Display tests (55 tests) - fare breakdown, comparisons, discounts, refunds All tests follow AAA pattern and use data-testid selectors matching Angular version. Total: 245 tests across 10 feature suites.
157 lines
3.7 KiB
TypeScript
157 lines
3.7 KiB
TypeScript
import { EventEmitter } from "events";
|
|
|
|
interface BasePromptOptions {
|
|
name: string | (() => string)
|
|
type: string | (() => string)
|
|
message: string | (() => string) | (() => Promise<string>)
|
|
prefix?: string
|
|
initial?: any
|
|
required?: boolean
|
|
enabled?: boolean | string
|
|
disabled?: boolean | string
|
|
format?(value: string): string | Promise<string>
|
|
result?(value: string): string | Promise<string>
|
|
skip?: ((state: object) => boolean | Promise<boolean>) | boolean
|
|
validate?(value: string): boolean | string | Promise<boolean | string>
|
|
onSubmit?(name: string, value: any, prompt: Enquirer.Prompt): boolean | Promise<boolean>
|
|
onCancel?(name: string, value: any, prompt: Enquirer.Prompt): boolean | Promise<boolean>
|
|
stdin?: NodeJS.ReadStream
|
|
stdout?: NodeJS.WriteStream
|
|
}
|
|
|
|
interface Choice {
|
|
name: string
|
|
message?: string
|
|
value?: unknown
|
|
hint?: string
|
|
role?: string
|
|
enabled?: boolean
|
|
disabled?: boolean | string
|
|
}
|
|
|
|
interface ArrayPromptOptions extends BasePromptOptions {
|
|
type:
|
|
| 'autocomplete'
|
|
| 'editable'
|
|
| 'form'
|
|
| 'multiselect'
|
|
| 'select'
|
|
| 'survey'
|
|
| 'list'
|
|
| 'scale'
|
|
choices: (string | Choice)[]
|
|
maxChoices?: number
|
|
multiple?: boolean
|
|
initial?: number
|
|
delay?: number
|
|
separator?: boolean
|
|
sort?: boolean
|
|
linebreak?: boolean
|
|
edgeLength?: number
|
|
align?: 'left' | 'right'
|
|
scroll?: boolean
|
|
}
|
|
|
|
interface BooleanPromptOptions extends BasePromptOptions {
|
|
type: 'confirm'
|
|
initial?: boolean
|
|
}
|
|
|
|
interface StringPromptOptions extends BasePromptOptions {
|
|
type: 'input' | 'invisible' | 'list' | 'password' | 'text'
|
|
initial?: string
|
|
multiline?: boolean
|
|
}
|
|
|
|
interface NumberPromptOptions extends BasePromptOptions {
|
|
type: 'numeral'
|
|
min?: number
|
|
max?: number
|
|
delay?: number
|
|
float?: boolean
|
|
round?: boolean
|
|
major?: number
|
|
minor?: number
|
|
initial?: number
|
|
}
|
|
|
|
interface SnippetPromptOptions extends BasePromptOptions {
|
|
type: 'snippet'
|
|
newline?: string
|
|
template?: string
|
|
}
|
|
|
|
interface SortPromptOptions extends BasePromptOptions {
|
|
type: 'sort'
|
|
hint?: string
|
|
drag?: boolean
|
|
numbered?: boolean
|
|
}
|
|
|
|
type PromptOptions =
|
|
| BasePromptOptions
|
|
| ArrayPromptOptions
|
|
| BooleanPromptOptions
|
|
| StringPromptOptions
|
|
| NumberPromptOptions
|
|
| SnippetPromptOptions
|
|
| SortPromptOptions
|
|
|
|
declare class BasePrompt extends EventEmitter {
|
|
constructor(options?: PromptOptions);
|
|
|
|
render(): void;
|
|
|
|
run(): Promise<any>;
|
|
}
|
|
|
|
declare class Enquirer<T = object> extends EventEmitter {
|
|
constructor(options?: object, answers?: T);
|
|
|
|
/**
|
|
* Register a custom prompt type.
|
|
*
|
|
* @param type
|
|
* @param fn `Prompt` class, or a function that returns a `Prompt` class.
|
|
*/
|
|
register(type: string, fn: typeof BasePrompt | (() => typeof BasePrompt)): this;
|
|
|
|
/**
|
|
* Register a custom prompt type.
|
|
*/
|
|
register(type: { [key: string]: typeof BasePrompt | (() => typeof BasePrompt) }): this;
|
|
|
|
/**
|
|
* Prompt function that takes a "question" object or array of question objects,
|
|
* and returns an object with responses from the user.
|
|
*
|
|
* @param questions Options objects for one or more prompts to run.
|
|
*/
|
|
prompt(
|
|
questions:
|
|
| PromptOptions
|
|
| ((this: Enquirer) => PromptOptions)
|
|
| (PromptOptions | ((this: Enquirer) => PromptOptions))[]
|
|
): Promise<T>;
|
|
|
|
/**
|
|
* Use an enquirer plugin.
|
|
*
|
|
* @param plugin Plugin function that takes an instance of Enquirer.
|
|
*/
|
|
use(plugin: (this: this, enquirer: this) => void): this;
|
|
}
|
|
|
|
declare namespace Enquirer {
|
|
function prompt<T = object>(
|
|
questions:
|
|
| PromptOptions
|
|
| ((this: Enquirer) => PromptOptions)
|
|
| (PromptOptions | ((this: Enquirer) => PromptOptions))[]
|
|
): Promise<T>;
|
|
|
|
class Prompt extends BasePrompt {}
|
|
}
|
|
|
|
export = Enquirer;
|