# @asdgf/testing-helpers

> A stupid simple way to test

Latest version **0.0.2** (published 2021-10-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install @asdgf/testing-helpers
pnpm add @asdgf/testing-helpers
yarn add @asdgf/testing-helpers
bun add @asdgf/testing-helpers
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2021-10-01 |
| First published | 2021-10-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 0 |
| Unpacked size | 45.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Maintainers | passle |
| Keywords | mocha, test, testing, assert, expect |

## Links

- npm: https://www.npmjs.com/package/@asdgf/testing-helpers
- Repository: https://github.com/thepassle/asdgf
- Homepage: https://github.com/thepassle/asdgf#readme
- Issues: https://github.com/thepassle/asdgf/issues
- npm.io page: https://npm.io/package/@asdgf/testing-helpers

## 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

- 0.0.2 (latest) — 2021-10-01
- 0.0.1 — 2021-10-01

## README

# `@asdgf/testing-helpers`

> A stupid simple way to test

No magic, no nonsense.

Opinionated package of small, performant, minified, ESM-friendly reexported helper libraries

## ~~Sinon~~ ➡️ [Hanbi](https://www.npmjs.com/package/hanbi)

```js
import { spy, stub, stubMethod, restore } from '@asdgf/testing-helpers/hanbi/index.js';
```

## ~~Chai~~ ➡️ [uvu/assert](https://www.npmjs.com/package/uvu)
```js
import { assert } from '@asdgf/testing-helpers/uvu/assert/index.js';
```

## [@open-wc/testing-helpers](https://www.npmjs.com/package/@open-wc/testing-helpers) fixture
```js
import { fixture, fixtureCleanup, html } from '@asdgf/testing-helpers/open-wc/index.js';
```

## [@open-wc/testing-helpers](https://www.npmjs.com/package/@open-wc/testing-helpers) timing
```js
import { waitUntil, nextFrame, aTimeout } from '@asdgf/testing-helpers/open-wc/timing/index.js';
```

## Example usage

```js
import { describe } from '@asdgf/core';
import * as hanbi from '@asdgf/testing-helpers/hanbi/index.js';
import { assert } from '@asdgf/testing-helpers/uvu/assert/index.js';
import { fixture, fixtureCleanup } from '@asdgf/testing-helpers/open-wc/index.js';

class MyElement extends HTMLElement {
  getName() {
    return 'world';
  }
  connectedCallback() {
    this.innerHTML = `<h1>hello ${this.getName()}</h1>`;
  }
}
customElements.define('my-element', MyElement);

describe('my-element', ({it, afterEach}) => {
  afterEach(fixtureCleanup);

  it('renders correctly', async () =>{
    const el = await fixture('<my-element></my-element>');
    const stub = hanbi.stubMethod(el, 'getName').returns('foo');
    el.connectedCallback();
    assert(el.textContent, 'hello foo');
    stub.restore();
  });
});
```

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