Test tool using proofdict.
npm install proofdict-testerTest tool using proofdict.
Install with npm:
npm install proofdict-tester
``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");
});
`
`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
match(text: string): Promise
}
See Releases page.
Install devDependencies and Run npm test:
npm i -d && npm test
Pull requests and stars are always welcome.
For bugs and feature requests, please create an issue.
1. Fork it!
2. Create your feature branch: git checkout -b my-new-featuregit commit -am 'Add some feature'
3. Commit your changes: git push origin my-new-feature`
4. Push to the branch:
5. Submit a pull request :D
MIT © azu