# @angeeks/testing

> Clean and Dry your Angular unit tests.

Latest version **1.1.0** (published 2018-06-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install @angeeks/testing
pnpm add @angeeks/testing
yarn add @angeeks/testing
bun add @angeeks/testing
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2018-06-05 |
| First published | 2018-05-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 147.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | speed.of.light |
| Keywords | angular, testing, unit test |

## Links

- npm: https://www.npmjs.com/package/@angeeks/testing
- Repository: https://github.com/angeeks/testing
- Homepage: https://angeeks.github.io/testing
- Issues: https://github.com/angeeks/testing/issues
- npm.io page: https://npm.io/package/@angeeks/testing

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^1.9.0

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2018-06-05
- 1.0.0 — 2018-05-30
- 0.0.1 — 2018-05-28

## README

# Testing

[![Build Status](https://travis-ci.org/angeeks/testing.svg?branch=master)](https://travis-ci.org/angeeks/testing)
[![npm version](https://badge.fury.io/js/%40angeeks%2Ftesting.svg)](https://www.npmjs.com/package/@angeeks/testing)

Clean and Dry your Angular unit tests.

# Why this?

Angular built with great testing tools for unit tests, but its flexibility introduces a lot of redundant code when project's components/services grow. @angeeks/testing aims to provide cleaner ways to write specs for most of common patterns with minimum efforts.
And then, we can get more time for another cup of tea :tea:, cheers.

## spec from official guide

```
import { TestBed, async } from '@angular/core/testing';
import { TediousComponent } from './tedious.component';

descirbe('handtypeed, emotional, typo prone spec title..', () => {
  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [
        TediousComponent
      ],
    }).compileComponents();
  }));
  // frequent used test pattern
  it('should create the app', async(() => {
    const fixture = TestBed.createComponent(AppComponent);
    const app = fixture.debugElement.componentInstance;
    expect(app).toBeTruthy();
  }));
  // frequent used test pattern
  it(`should have as title 'ngk'`, async(() => {
    const fixture = TestBed.createComponent(AppComponent);
    const app = fixture.debugElement.componentInstance;
    expect(app.title).toEqual('ngk');
  }));
});
```

## With @angeeks/testing

```
import { ComponentSuite as Component } from '@angeeks/testing';
import { TediousComponent as Subject } from './tedious.component';

Component.suite<Subject>(Subject, (spec) => {
  spec.init();
  spec.expectProperty('title', 'ngk');
});
```

And the report will be like:

```
  ngk-root
    ✓ should be created (68ms)
    ✓ has .title to equal "ngk" (44ms)
```

# Installation

```
  npm i -D @angeeks/testing
```

# APIs

## Suite.on<Subject>(Subject, callback: (spec: Suite) => {})
## Suite.suite<Subject>(Subject, callback: (spec: Suite) => {})

- Subject for the spec
- callback for jasmine describe, with spec instance keep common variables

## Suite.fon<Subject>(Subject, callback: (spec: Suite) => {})
## Suite.fsuite<Subject>(Subject, callback: (spec: Suite) => {})

Same like fdescribe

---
_Source: https://npm.io/package/@angeeks/testing · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
