Skip to content

Commit

Permalink
updating tests
Browse files Browse the repository at this point in the history
  • Loading branch information
erindepew committed Feb 7, 2018
1 parent dc22098 commit 7e14e53
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions tests/lib/linter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1931,15 +1931,14 @@ describe("Linter", () => {
assert.strictEqual(messages[0].ruleId, "no-alert");
});

it("should report a violation", () => {
it("should report a violation if eslint-disable-line in a block comment is not on a single line", () => {
const code = [
"/* eslint-disable-line",
"*",
"*/ console.log('test');" // here
].join("\n");
const config = {
rules: {
"no-alert": 1,
"no-console": 1
}
};
Expand All @@ -1951,18 +1950,16 @@ describe("Linter", () => {
assert.strictEqual(messages[0].ruleId, "no-console");
});

it("should report a violation if block comment is not on a single line", () => {
it("should report a violation if eslint-disable-line in a block comment is not on a single line", () => {
const code = [
"alert('test'); /* eslint-disable-line ",
"no-alert */",
"console.log('test'); /* eslint-disable-line */"
"no-alert */"
].join("\n");
const config = {
rules: {
"no-alert": 1,
quotes: [1, "double"],
semi: [1, "always"],
"no-console": 1
semi: [1, "always"]
}
};

Expand All @@ -1974,10 +1971,10 @@ describe("Linter", () => {
assert.strictEqual(messages[1].ruleId, "quotes");
});

it("should not report a violation", () => {
it("should not report a violation for eslint-disable-line in block comment", () => {
const code = [
"alert('test'); // eslint-disable-line no-alert",
"alert('test'); /*eslint-disable-line no-alert*/" // here
"alert('test'); /*eslint-disable-line no-alert*/"
].join("\n");
const config = {
rules: {
Expand Down Expand Up @@ -2052,8 +2049,7 @@ describe("Linter", () => {
const config = {
rules: {
"no-alert": 1,
quotes: [1, "single"],
"no-console": 1
quotes: [1, "single"]
}
};
const messages = linter.verify(code, config, filename);
Expand Down Expand Up @@ -2081,7 +2077,7 @@ describe("Linter", () => {
assert.strictEqual(messages[0].ruleId, "no-console");
});

it("should ignore violation of specified rule if comment is in block quotes", () => {
it("should ignore violation of specified rule if eslint-disable-next-line is a block comment", () => {
const code = [
"/* eslint-disable-next-line no-alert */",
"alert('test');",
Expand All @@ -2098,7 +2094,7 @@ describe("Linter", () => {
assert.strictEqual(messages.length, 1);
assert.strictEqual(messages[0].ruleId, "no-console");
});
it("should ignore violation of specified rule if comment is in block quotes", () => {
it("should ignore violation of specified rule if eslint-disable-next-line is a block comment", () => {
const code = [
"/* eslint-disable-next-line no-alert */",
"alert('test');"
Expand Down Expand Up @@ -2248,7 +2244,7 @@ describe("Linter", () => {
assert.strictEqual(messages[0].ruleId, "no-console");
});

it("should ignore violations if comment is in block quotes", () => {
it("should ignore violations if eslint-disable-next-line is a block comment", () => {
const code = [
"alert('test');",
"/* eslint-disable-next-line no-alert */",
Expand Down

0 comments on commit 7e14e53

Please sign in to comment.