]>
git.proxmox.com Git - pve-eslint.git/blob - eslint/tests/lib/linter/rule-fixer.js
2 * @fileoverview Tests for rule fixer.
3 * @author Nicholas C. Zakas
7 //------------------------------------------------------------------------------
9 //------------------------------------------------------------------------------
11 const assert
= require("chai").assert
,
12 ruleFixer
= require("../../../lib/linter/rule-fixer");
14 //------------------------------------------------------------------------------
16 //------------------------------------------------------------------------------
18 describe("RuleFixer", () => {
20 describe("insertTextBefore", () => {
22 it("should return an object with the correct information when called", () => {
24 const result
= ruleFixer
.insertTextBefore({ range
: [0, 1] }, "Hi");
26 assert
.deepStrictEqual(result
, {
35 describe("insertTextBeforeRange", () => {
37 it("should return an object with the correct information when called", () => {
39 const result
= ruleFixer
.insertTextBeforeRange([0, 1], "Hi");
41 assert
.deepStrictEqual(result
, {
50 describe("insertTextAfter", () => {
52 it("should return an object with the correct information when called", () => {
54 const result
= ruleFixer
.insertTextAfter({ range
: [0, 1] }, "Hi");
56 assert
.deepStrictEqual(result
, {
65 describe("insertTextAfterRange", () => {
67 it("should return an object with the correct information when called", () => {
69 const result
= ruleFixer
.insertTextAfterRange([0, 1], "Hi");
71 assert
.deepStrictEqual(result
, {
80 describe("removeAfter", () => {
82 it("should return an object with the correct information when called", () => {
84 const result
= ruleFixer
.remove({ range
: [0, 1] });
86 assert
.deepStrictEqual(result
, {
95 describe("removeAfterRange", () => {
97 it("should return an object with the correct information when called", () => {
99 const result
= ruleFixer
.removeRange([0, 1]);
101 assert
.deepStrictEqual(result
, {
111 describe("replaceText", () => {
113 it("should return an object with the correct information when called", () => {
115 const result
= ruleFixer
.replaceText({ range
: [0, 1] }, "Hi");
117 assert
.deepStrictEqual(result
, {
126 describe("replaceTextRange", () => {
128 it("should return an object with the correct information when called", () => {
130 const result
= ruleFixer
.replaceTextRange([0, 1], "Hi");
132 assert
.deepStrictEqual(result
, {