# proofdict-tester

> Test tool using proofdict.

Latest version **1.0.0** (published 2018-02-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install proofdict-tester
pnpm add proofdict-tester
yarn add proofdict-tester
bun add proofdict-tester
```

## 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.0 |
| Published | 2018-02-25 |
| First published | 2017-08-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 23.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | azu |
| Maintainers | azu |
| Keywords | prooftest, dictionary, testing, test |

## Links

- npm: https://www.npmjs.com/package/proofdict-tester
- Repository: https://github.com/proofdict/proofdict-tester
- Issues: https://github.com/proofdict/proofdict-tester/issues
- npm.io page: https://npm.io/package/proofdict-tester

## Dependencies (1)

- [prh](https://npm.io/package/prh.md) 5.4.3

## 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.0.0 (latest) — 2018-02-25
- 0.3.3 — 2017-09-06
- 0.3.2 — 2017-09-06
- 0.3.1 — 2017-08-20
- 0.3.0 — 2017-08-20
- 0.2.0 — 2017-08-20
- 0.1.2 — 2017-08-20
- 0.1.1 — 2017-08-20

## README

# proofdict-tester [![Build Status](https://travis-ci.org/proofdict/proofdict-tester.svg?branch=master)](https://travis-ci.org/proofdict/proofdict-tester)

Test tool using proofdict.

## Install

Install with [npm](https://www.npmjs.com/):

    npm install proofdict-tester

## Usage

```ts
const proofdict = require("./fixtures/proofdict.json");
const tester = new ProofdictTester(proofdict);
const text = "Workaound is typo.";
return tester.match(text).then(result => {
    assert.strictEqual(result.details.length, 1);
    const [detail] = result.details;
    assert.strictEqual(detail.actual, "Workaound");
    assert.strictEqual(detail.expected, "Workaround");
    assert.strictEqual(detail.matchStartIndex, 0);
    assert.strictEqual(detail.matchEndIndex, 9);
    assert.strictEqual(text.slice(detail.matchStartIndex, detail.matchEndIndex), "Workaound");
});

```

### API

```ts
import { Diff } from "prh";
export interface Proofdict {
    expected: string;
    patterns: string[];
    description: string;
    id?: string;
    specs?: ProofdictSpec[];
    tags: string[];
}
export interface ProofdictSpec {
    from: string;
    to: string;
}
export interface ProofdictTesterResultDetail {
    description?: string;
    matchStartIndex: number;
    matchEndIndex: number;
    actual: string;
    expected: string;
}
export interface ProofdictTesterResult {
    output: string;
    details: ProofdictTesterResultDetail[];
    diffs: Diff[];
}
export declare class ProofdictTester {
    constructor(proofdictData: Proofdict[]);
    replace(text: string): Promise<string>;
    match(text: string): Promise<ProofdictTesterResult>;
}
```

## Changelog

See [Releases page](https://github.com/proofdict/proofdict-tester/releases).

## Running tests

Install devDependencies and Run `npm test`:

    npm i -d && npm test

## Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, [please create an issue](https://github.com/proofdict/proofdict-tester/issues).

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D

## Author

- [github/azu](https://github.com/azu)
- [twitter/azu_re](https://twitter.com/azu_re)

## License

MIT © azu

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