npm package: @rbxts/jest-extended
Description: Additional Jest matchers for roblox-ts projects.
Author: Christopher Buss
Latest version: 1.0.1

# @rbxts/jest-extended

Additional Jest matchers for roblox-ts. Port of
[jest-extended](https://github.com/jest-community/jest-extended).

## Installation

```sh
pnpm add @rbxts/jest-extended
```

## Setup

```ts
import * as matchers from "@rbxts/jest-extended";

expect.extend(matchers);
```

Or add individual matchers:

```ts
import { toBeFalse, toBeTrue } from "@rbxts/jest-extended";

expect.extend({ toBeFalse, toBeTrue });
```

Type declarations are included automatically via `types.d.ts`.

## Matchers

### Boolean

- `.toBeTrue()`
- `.toBeFalse()`
- `.toBeBoolean()`

### Number

- `.toBeNumber()`
- `.toBeInteger()`
- `.toBeEven()`
- `.toBeOdd()`
- `.toBePositive()`
- `.toBeNegative()`
- `.toBeFinite()`
- `.toBeWithin(start, end)`
- `.toBeBetween(startDate, endDate)`
- `.toBeInRange(min, max)`

### String

- `.toBeString()`
- `.toBeSymbol()`
- `.toBeHexadecimal()`
- `.toStartWith(prefix)`
- `.toEndWith(suffix)`
- `.toInclude(substring)`
- `.toIncludeMultiple(substrings)`
- `.toIncludeRepeated(substring, times)`
- `.toEqualCaseInsensitive(value)`
- `.toEqualIgnoringWhitespace(value)`

### Array

- `.toBeArray()`
- `.toBeArrayOfSize(size)`
- `.toBeEmpty()`
- `.toIncludeAllMembers(members)`
- `.toIncludeAnyMembers(members)`
- `.toIncludeSameMembers(members)`
- `.toIncludeAllPartialMembers(members)`
- `.toIncludeSamePartialMembers(members)`
- `.toPartiallyContain(member)`
- `.toSatisfy(predicate)`
- `.toSatisfyAll(predicate)`
- `.toSatisfyAny(predicate)`

### Object

- `.toBeObject()`
- `.toBeEmptyObject()`
- `.toBeFrozen()`
- `.toContainKey(key)`
- `.toContainKeys(keys)`
- `.toContainAllKeys(keys)`
- `.toContainAnyKeys(keys)`
- `.toContainValue(value)`
- `.toContainValues(values)`
- `.toContainAllValues(values)`
- `.toContainAnyValues(values)`
- `.toContainEntry(entry)`
- `.toContainEntries(entries)`
- `.toContainAllEntries(entries)`
- `.toContainAnyEntries(entries)`

### Function

- `.toBeFunction()`
- `.toThrowWithMessage(type, message)`

### Mock

- `.toHaveBeenCalledOnce()`
- `.toHaveBeenCalledExactlyOnceWith(...args)`
- `.toHaveBeenCalledBefore(mock)`
- `.toHaveBeenCalledAfter(mock)`

### Date (DateTime)

- `.toBeDate()`
- `.toBeValidDate()`
- `.toBeAfter(date)`
- `.toBeBefore(date)`
- `.toBeAfterOrEqualTo(date)`
- `.toBeBeforeOrEqualTo(date)`

### Mutator

- `.toChange(checker)`
- `.toChangeBy(checker, by)`
- `.toChangeTo(checker, to)`

### Other

- `.toBeOneOf(members)`
- `.pass(message?)`
- `.fail(message?)`

## Not yet ported

| Matcher     | Status                           |
| ----------- | -------------------------------- |
| `toResolve` | Async matchers not yet supported |
| `toReject`  | Async matchers not yet supported |

## Unsupported matchers

These upstream matchers have no Luau equivalent and are not included:

| Matcher          | Reason                    |
| ---------------- | ------------------------- |
| `toBeBigInt`     | No BigInt in Luau         |
| `toBeSealed`     | No `Object.isSealed`      |
| `toBeExtensible` | No `Object.isExtensible`  |
| `toBeNil`        | Already in base jest      |
| `toBeNaN`        | Already in base jest      |
| `toBeDateString` | No string-to-date parsing |

## LICENSE

[MIT](LICENSE)