# ts-jasmine-immutable-matchers

> Jasmine Immutable Matchers for Typescript

Latest version **1.0.2** (published 2017-12-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install ts-jasmine-immutable-matchers
pnpm add ts-jasmine-immutable-matchers
yarn add ts-jasmine-immutable-matchers
bun add ts-jasmine-immutable-matchers
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2017-12-22 |
| First published | 2017-12-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | ken |
| Maintainers | piq9117 |
| Keywords | immutable, immutabljs, jasmine-matchers, jasmine, matchers, typescript, karma-jasmine |

## Links

- npm: https://www.npmjs.com/package/ts-jasmine-immutable-matchers
- Repository: https://github.com/piq9117/ts-jasmine-immutable-matchers
- Issues: https://github.com/piq9117/ts-jasmine-immutable-matchers/issues
- npm.io page: https://npm.io/package/ts-jasmine-immutable-matchers

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2017-12-22
- 1.0.1 — 2017-12-22
- 1.0.0 — 2017-12-22
- 0.0.20-alpha — 2017-12-21
- 0.0.19-alpha — 2017-12-18
- 0.0.18-alpha — 2017-12-17
- 0.0.17-alpha — 2017-12-17
- 0.0.16-alpha — 2017-12-17
- 0.0.15-alpha — 2017-12-17
- 0.0.14-alpha — 2017-12-17
- 0.0.13-alpha — 2017-12-17
- 0.0.12-alpha — 2017-12-17
- 0.0.11-alpha — 2017-12-17
- 0.0.10-alpha — 2017-12-17
- 0.0.9-alpha — 2017-12-16
- … 9 more at https://npm.io/package/ts-jasmine-immutable-matchers/versions

## README

# ts-jasmine-immutable-matchers

[Jasmine](https://jasmine.github.io/) custom matchers for [Immutablejs](https://facebook.github.io/immutable-js/).

## Installation
```
$ npm install --save-dev ts-jasmine-immutable-matchers
```
(I know, the module name is pretty long ¯\_(ツ)_/¯)

## Usage
Load the matchers in a `beforeEach` block.
```typescript
import { matchers } from "ts-jasmine-immutable-matchers";

declare("Your Awesome Tests", () => {
  beforeEach(() => jasmine.addMatchers(matchers));
});
```

## API
### toBeImmutable
Asserts that the data structure is immutable.

```typescript
import { List } from "immutable";

declare("Immutable", () => {
  it("is not immutable", () => {
    const arr = [1, 2];
    expect(arr).not.toBeImmutable();
  });

  it("is immutable", () => {
    const list = List.of(1, 2);
    expect(list).toBeImmutable();
  })
});
```
### toBeIterableImmutable
Asserts that the data structure is an iterable immutable.

```typescript
import { List } from "immutable";

declare("Iterable immutable", () => {
  it("is not an iterable immutable", () => {
    const arr = [1, 2];
    expect(arr).not.toBeIterableImmutable();
  });
  
  it("is an iterable immutable", () => {
    const list = List.of(1, 2);
    expect(list).toBeIterableImmutable();
  })
});
```
### toBeKeyedImmutable
Asserts that the data structure is keyed immutable structure.
```typescript
import { Map, List } from "immutable";

declare("Keyed immutable", () => {
  it("it is not a keyed immutable", () => {
    const list = List.of(1, 2);
    expect(list).not.toBeKeyedImmutable();
  });
  
  it("is a keyed immutable", () => {
    const map = Map({ a: 1 });
    expect(map).toBeKeyedImmutable();
  });
});
```
### toBeIndexedImmutable
Asserts that the data structure is an indexed immutable structure.
```typescript
import { Map, List } from "immutable";

declare("Indexed Immutable", () => {
  it("is not an indexed immutable", () => {
    const map = Map({ a: 1 });
    expect(map).not.toBeIndexedImmutable();
  }):
  
  it("is an indexed immutable", () => {
    const list = List.of(1, 2);
    expect(list).toBeIndexedImmutable();
  });
});
```

### toBeAssociativeImmutable
Asserts that the data structure is an associative immutable structure.
```typescript
import { fromJS, Map } from "immutable";

declare("Associtive Immutable", () => {
  it("is not an associative immutable", () => {
    const f = fromJS("not associative");
    expect(f).not.toBeAssociativeImmutable();
  });
  
  it("is an associative immutable", () => {
    const map = Map({ a: 1 });
    expect(m).toBeAssociativeImmutable();
  });
});
```

### toBeOrderedImmutable
Asserts that the data structure is an ordered immutable structure.
```typescript
import { Map, List, OrderedMap, OrderedSet } from "immutable";

declare("Ordered Immutable", () => {
  it("is not ann ordered immutable", () => {
    const map = Map({ a: 1 });
    expect(map).not.toBeOrderedImmutable();
  });
  
  it("is an ordered immutable", () => {
    const l = List.of(1, 2);
    const o = OrderedMap({ a: 1 }, {b: 2});
    const s = OrderedSet([1, 2]);
    expect(l).toBeOrderedImmutable();
    expect(o).toBeOrderedImmutable();
    expect(s).toBeOrderedImmutable();
  });
});
```

### toBeImmutableList
Asserts that the data structure is an immutable list.
```typescript
import { List, Map } from "immutable";

declare("Immutable List", () => {
  it("it is not an immutable list", () => {
    const map = Map({ a: 1 });
    expect(m).not.toBeImmutableList();
  });
  
  it("is an immutable list", () => {
    const l1 = List.of(1, 2);
    const l2 = List([1, 2]);
    expect(l1).toBeImmutableList();
    expect(l2).toBeImmutableList();
  });
});
```

### toBeImmutableMap
Asserts that the data structure is an immutable map.
```typescript
import { List, Map } from "immutable";

declare("Immutable Map", () => {
  it("is not an immutable map", () => {
    const l = List.of(1, 2);
    expect(l).not.toBeImmutableMap();
  });
  
  it("is an immutable map", () => {
    const m = Map({ a: 1 });
    expect(m).toBeImmutableMap();
  });
});
```

### toBeImmutableOrderedMap
Asserts that the data structure is an immutable ordered map.
```typescript
import { Map, OrderedMap } from "immutable";

declare("Immutable Ordered Map", () => {
  it("is not an ordered immutable map", () => {
    const m = Map({ a: 1 });
    expect(m).not.toBeImmutableOrderedMap();
  });
  
  it("is an immutable map", () => {
    const o = OrdereMap({ a: 1 }, { b: 2 });
    expect(o).toBeImmutableOrderedMap();
  });
});
```

### toBeImmutableOrderedSet
Asserts that the data structure is an immutable ordered set.
```typescript
import { OrderedSet, Map } from "immutable";

declare("Immutable Oredered Set", () => {
  it("is not an ordered immutable set", () => {
    const m = Map({a: 1});
    expect(m).not.toBeImmutableOrderedSet();
  });
  
  it("is an ordered immutable set", () => {
    const s = OrderedSet([1, 2]);
    expect(s).toBeImmutableOrderedSet();
  });
});
```

### toBeImmutableSet
Asserts that the data structure is an immutable set.
```typescript
import { Set, Map } from "immutable";

declare("Immutable Set", () => {
  it("is not an immutable set", () => {
    const m = Map({ a: 1 });
    expect(m).not.toBeImmutableSet();
  });
  
  it("is an immutable set", () => {
    const s = Set([1, 2]);
    expect(s).toBeImmutableSet();
  });
});
```

### toBeImmutableStack
Asserts that the data structure is an immutable stack.
```typescript
improt { Stack } from "immutable";

declare("Immutable Stack", () => {
  it("is not an immutable stack", () => {
    const a = [1, 2];
    expect(a).not.toBeImmutableStack();
  });
  
  it("is an immutable stack", () => {
    const s = Stack([1, 2]);
    expect(s).toBeImmutableStack();
  });
});
```

### toBeImmutableSeq
Asserts that the structure is an immutable sequence.
```typescript
import { Seq } from "immutable";

declare("Immutable Sequence", () => {
  it("is not an immutable sequence", () => {
    const a = [1, 2];
    expect(a).not.toBeImmutableSeq();
  });
  
  it("is an immutable sequence", () => {
    const s = Seq([1, 2]);
    expect(s).toBeImmutableSeq();
  });
});

```

### toEqualImmutable
Asserts that the input immutable argument is equal to expected immutable input.
```typescript
import { Map, List } from "immutable";

declare("Equal another Immutable", () => {
  it("does not equal another immutable list", () => {
    const l1 = List.of(1, 2);
    const l2 = List.of(1, 2, 3);
    expect(l1).not.toBe(l2);
    expect(l1).not.toEqualImmutable(l2);
  });
  
  it("is equal to another immutable list", () => {
    const l1 = List.of(1, 2);
    const l2 = List.of(1, 2);
    expect(l1).not.toBe(l2);
    expect(l1).toEqualImmutable(l2);
  });
  
  it("does not equal another immutable map", () => {
    const m1 = Map({ a: 1 });
    const m2 = Map({ b: 2 })
    expect(m1).not.toBe(m2);
    expect(m1).not.toEqualImmutable();
  });
  
  it("is equal to another immutable map", () => {
    const m1 = Map({ a: 1 });
    const m2 = Map({ a: 1 });
    expect(m1).not.toBe(m2);
    expect(m1).toEqualImmutable();
  });
});
```

---
_Source: https://npm.io/package/ts-jasmine-immutable-matchers · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
