|
1 | 1 | // LICENSE : MIT |
2 | 2 | "use strict"; |
3 | 3 | import assert from "power-assert"; |
4 | | -import {textlint} from "textlint"; |
| 4 | +import { textlint } from "textlint"; |
5 | 5 | import rule from "../src/textlint-rule-prh"; |
6 | | -describe("prh-rule-test", function () { |
7 | | - beforeEach(function () { |
8 | | - textlint.setupRules({ |
9 | | - "prh": rule |
10 | | - }, { |
11 | | - "prh": { |
12 | | - "rulePaths": [__dirname + "/fixtures/rule.yaml"] |
| 6 | +describe("prh-rule-test", function() { |
| 7 | + beforeEach(function() { |
| 8 | + textlint.setupRules( |
| 9 | + { |
| 10 | + prh: rule |
| 11 | + }, |
| 12 | + { |
| 13 | + prh: { |
| 14 | + rulePaths: [__dirname + "/fixtures/rule.yaml"] |
| 15 | + } |
13 | 16 | } |
14 | | - }); |
| 17 | + ); |
15 | 18 | }); |
16 | | - afterEach(function () { |
| 19 | + afterEach(function() { |
17 | 20 | textlint.resetRules(); |
18 | 21 | }); |
19 | | - context("when match word", function () { |
20 | | - it("should report error", function () { |
| 22 | + context("when match word", function() { |
| 23 | + it("should report error", function() { |
21 | 24 | return textlint.lintMarkdown("テストjquery").then(result => { |
22 | 25 | assert(result.messages.length > 0); |
23 | 26 | assert(result.messages[0].line === 1); |
24 | 27 | assert(result.messages[0].column === 4); |
25 | 28 | }); |
26 | 29 | }); |
27 | 30 | }); |
28 | | - context("when match word and s/) /)/ pattern", function () { |
29 | | - it("should report error", function () { |
| 31 | + context("when match word and s/) /)/ pattern", function() { |
| 32 | + it("should report error", function() { |
30 | 33 | return textlint.lintMarkdown("(図1) ").then(result => { |
31 | 34 | assert(result.messages.length > 0); |
32 | 35 | assert(result.messages[0].line === 1); |
33 | 36 | assert(result.messages[0].column === 4); |
34 | 37 | }); |
35 | 38 | }); |
36 | 39 | }); |
37 | | - context("when match word but s/Web/Web/i pattern", function () { |
| 40 | + context("when match word but s/Web/Web/i pattern", function() { |
38 | 41 | // fix ignore (the) case |
39 | | - it("should not report", function () { |
| 42 | + it("should not report", function() { |
40 | 43 | return textlint.lintMarkdown("jQuery").then(result => { |
41 | 44 | assert(result.messages.length === 0); |
42 | 45 | }); |
43 | 46 | }); |
44 | 47 | }); |
45 | | - context("when match word and s/ベンダ/ベンダー/ pattern", function () { |
| 48 | + context("when match word and s/ベンダ/ベンダー/ pattern", function() { |
46 | 49 | // expected word contain actual word. |
47 | 50 | // s/ベンダ/ベンダー/ のようにexpectedがpatternを包含している場合のexpectedを除外 |
48 | | - it("should not report", function () { |
| 51 | + it("should not report", function() { |
49 | 52 | return textlint.lintMarkdown("ベンダー").then(result => { |
50 | 53 | assert(result.messages.length === 0); |
51 | 54 | }); |
52 | 55 | }); |
53 | 56 | }); |
54 | | - context("when expected contain $1", function () { |
| 57 | + context("when expected contain $1", function() { |
55 | 58 | // expected word contain actual word. |
56 | 59 | // s/ベンダ/ベンダー/ のようにexpectedがpatternを包含している場合のexpectedを除外 |
57 | | - it("should convert expected", function () { |
| 60 | + it("should convert expected", function() { |
58 | 61 | return textlint.lintMarkdown("広義のソフトウエアについて").then(result => { |
59 | 62 | assert(result.messages.length > 0); |
60 | 63 | var message = result.messages[0].message; |
61 | 64 | assert.equal(message, "のソフトウエア => のソフトウェア"); |
62 | 65 | }); |
63 | 66 | }); |
64 | 67 | }); |
65 | | - context("when fixer", function () { |
| 68 | + context("when fixer", function() { |
66 | 69 | // expected word contain actual word. |
67 | 70 | // s/ベンダ/ベンダー/ のようにexpectedがpatternを包含している場合のexpectedを除外 |
68 | | - it("should convert expected", function () { |
69 | | - return textlint.fixText("広義のソフトウエアについて", ".md").then(({output}) => { |
| 71 | + it("should convert expected", function() { |
| 72 | + return textlint.fixText("広義のソフトウエアについて", ".md").then(({ output }) => { |
70 | 73 | assert.equal(output, "広義のソフトウェアについて"); |
71 | 74 | }); |
72 | 75 | }); |
|
0 commit comments