// LICENSE : MIT
"use strict";
import assert from "assert";
import preset from "../src/index";
import { TextLintCore } from "textlint";
import fs from "fs";

describe("fixer-test", function () {
    it("should convert expected", function () {
        const expected = fs.readFileSync(__dirname + "/fixtures/output.md", "utf-8");
        const textlint = new TextLintCore();
        // all true
        textlint.setupRules(preset.rules);
        return textlint.fixFile(__dirname + "/fixtures/input.md").then((result) => {
            assert.equal(result.remainingMessages.length, 0);
            const inputs = result.output.split("\n");
            const outputs = expected.split("\n");
            for (var i = 0; i < inputs.length; i++) {
                const input = inputs[i];
                const output = outputs[i];
                assert.strictEqual(input, output);
            }
        });
    });
});

@@ -125,24 +125,49 @@
 %22textlint%22;%0A
+import path from %22path%22;%0A
 import fs fr
@@ -175,16 +175,16 @@
 m %22fs%22;%0A
-
 %0Adescrib
@@ -302,16 +302,26 @@
 ileSync(
+path.join(
 __dirnam
@@ -313,34 +313,33 @@
 h.join(__dirname
- +
+,
  %22/fixtures/outp
@@ -344,16 +344,17 @@
 tput.md%22
+)
 , %22utf-8
@@ -497,16 +497,26 @@
 fixFile(
+path.join(
 __dirnam
@@ -520,10 +520,9 @@
 name
- +
+,
  %22/f
@@ -539,16 +539,17 @@
 put.md%22)
+)
 .then((r
@@ -903,21 +903,235 @@
 ual(
-input, output
+%0A                    input,%0A                    output,%0A                    %60mismatch at line $%7Bi%7D%0A%0Aat $%7Bpath.join(__dirname, %22/fixtures/input.md%22)%7D:$%7Bi%7D%0Aat $%7Bpath.join(__dirname, %22/fixtures/output.md%22)%7D:$%7Bi%7D%0A%60%0A                
 );%0A 

fix test