Skip to main content
zerotal

Documentation


Documentation / @zerotal/notifications / NotificationsTestCommand

Class: NotificationsTestCommand

Defined in: notifications/src/commands/NotificationsTestCommand.ts:32

zt notifications:test <email> — send one real email through the configured mail driver.

Mail configuration fails in ways unit tests cannot reach: a wrong port, a refused STARTTLS upgrade, credentials the server rejects. This exercises the whole path and prints what the server said.

Extends

Constructors

Constructor

new NotificationsTestCommand(): NotificationsTestCommand

Returns

NotificationsTestCommand

Inherited from

Command.constructor

Properties

flags

static flags: FlagDef[] = []

Defined in: core/src/command/Command.ts:68

Inherited from

Command.flags


_writer

_writer: OutputWriter

Defined in: core/src/command/Command.ts:71

Output destination. Replaced with BufferWriter by Artisan.call().

Inherited from

Command._writer


args

args: Record<string, string> = {}

Defined in: core/src/command/Command.ts:74

Parsed positional arguments — set by CommandRunner before run().

Inherited from

Command.args


flags

flags: Record<string, string | boolean | number> = {}

Defined in: core/src/command/Command.ts:76

Parsed flags — set by CommandRunner before run().

Inherited from

Command.flags


app

app: unknown = undefined

Defined in: core/src/command/Command.ts:78

Application instance — set by CommandRunner when needsApp is true.

Inherited from

Command.app


commandName

static commandName: string = "notifications:test"

Defined in: notifications/src/commands/NotificationsTestCommand.ts:33

Overrides

Command.commandName


description

static description: string = "Send a test email through the configured mail driver"

Defined in: notifications/src/commands/NotificationsTestCommand.ts:34

Overrides

Command.description


needsApp

static needsApp: boolean = true

Defined in: notifications/src/commands/NotificationsTestCommand.ts:35

Overrides

Command.needsApp


args

static args: ArgDef[]

Defined in: notifications/src/commands/NotificationsTestCommand.ts:37

Overrides

Command.args

Methods

info()

info(msg): void

Defined in: core/src/command/Command.ts:82

Parameters

msg

string

Returns

void

Inherited from

Command.info


error()

error(msg): void

Defined in: core/src/command/Command.ts:85

Parameters

msg

string

Returns

void

Inherited from

Command.error


warn()

warn(msg): void

Defined in: core/src/command/Command.ts:88

Parameters

msg

string

Returns

void

Inherited from

Command.warn


line()

line(msg): void

Defined in: core/src/command/Command.ts:91

Parameters

msg

string

Returns

void

Inherited from

Command.line


dim()

dim(msg): void

Defined in: core/src/command/Command.ts:94

Parameters

msg

string

Returns

void

Inherited from

Command.dim


write()

write(msg): void

Defined in: core/src/command/Command.ts:97

Parameters

msg

string

Returns

void

Inherited from

Command.write


newLine()

newLine(): void

Defined in: core/src/command/Command.ts:100

Returns

void

Inherited from

Command.newLine


section()

section(title): void

Defined in: core/src/command/Command.ts:103

Parameters

title

string

Returns

void

Inherited from

Command.section


table()

table(rows, indent?): void

Defined in: core/src/command/Command.ts:106

Parameters

rows

[string, string][]

indent?

number = 2

Returns

void

Inherited from

Command.table


ask()

ask(question, defaultValue?): Promise<string>

Defined in: core/src/command/Command.ts:127

Prompt the user for text input and wait for Enter.

Parameters

question

string

defaultValue?

string

Returns

Promise<string>

Example

const name = await this.ask('What is your name?');
const env  = await this.ask('Environment?', 'production');

Inherited from

Command.ask


confirm()

confirm(question, defaultValue?): Promise<boolean>

Defined in: core/src/command/Command.ts:142

Prompt the user for a yes/no confirmation. Returns true for y/yes, false otherwise.

Parameters

question

string

defaultValue?

boolean = false

Returns

Promise<boolean>

Example

const ok = await this.confirm('Run migrations?');
const ok = await this.confirm('Overwrite file?', true);

Inherited from

Command.confirm


choice()

choice(question, options): Promise<string>

Defined in: core/src/command/Command.ts:157

Prompt the user to select one option from a numbered list. Returns the selected string. Defaults to the first option on invalid input.

Parameters

question

string

options

string[]

Returns

Promise<string>

Example

const env = await this.choice('Environment:', ['local', 'staging', 'production']);

Inherited from

Command.choice


secret()

secret(question): Promise<string>

Defined in: core/src/command/Command.ts:170

Parameters

question

string

Returns

Promise<string>

Inherited from

Command.secret


_readLine()

_readLine(): Promise<string>

Defined in: core/src/command/Command.ts:213

Read one line from stdin. Override in tests to avoid blocking.

Returns

Promise<string>

Inherited from

Command._readLine


run()

run(): Promise<void>

Defined in: notifications/src/commands/NotificationsTestCommand.ts:39

Returns

Promise<void>

Overrides

Command.run