Skip to main content

@rbxts/expect > ExpectMessageBuilder > negationSuffix

ExpectMessageBuilder.negationSuffix() method

Adds a string to show at the end of the message, before the metadata.

Only applies if the message is negated.

Signature:

negationSuffix(str?: string): this;

Parameters

Parameter

Type

Description

str

string

(Optional) The string to add after the message.

Returns:

this

This instance, for chaining.

Remarks

Will be used instead of the existing suffix (if any).

Note that there can only be one, calling this method again will replace the previous value- not append to it

Example

new ExpectMessageBuilder(
`Expected ${place.name} to ${place.not} equal ${place.expected.value}`
)
.suffix(", but it was not.")
.negationSuffix(", but it did");

// Would be the same as
new ExpectMessageBuilder(
`Expected ${place.name} to equal ${place.expected.value},
but it was not.`,

`Expected ${place.name} to NOT equal ${place.expected.value},
but it did.`,
);