diff --git a/.eslintignore.errorfiles b/.eslintignore.errorfiles index 6ffeda8db9..1baf76ba67 100644 --- a/.eslintignore.errorfiles +++ b/.eslintignore.errorfiles @@ -12,8 +12,6 @@ src/utils/MultiInviter.js test/components/structures/MessagePanel-test.js test/components/views/dialogs/InteractiveAuthDialog-test.js test/mock-clock.js -test/notifications/ContentRules-test.js -test/notifications/PushRuleVectorState-test.js src/component-index.js test/end-to-end-tests/node_modules/ test/end-to-end-tests/riot/ diff --git a/test/notifications/ContentRules-test.js b/test/notifications/ContentRules-test.js index 3bf0a0426d..ca25edf5b1 100644 --- a/test/notifications/ContentRules-test.js +++ b/test/notifications/ContentRules-test.js @@ -14,15 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -var notifications = require('../../src/notifications'); +const notifications = require('../../src/notifications'); -var ContentRules = notifications.ContentRules; -var PushRuleVectorState = notifications.PushRuleVectorState; +const ContentRules = notifications.ContentRules; +const PushRuleVectorState = notifications.PushRuleVectorState; -var expect = require('expect'); -var test_utils = require('../test-utils'); - -var NORMAL_RULE = { +const NORMAL_RULE = { actions: [ "notify", { set_tweak: "highlight", value: false }, @@ -32,7 +29,7 @@ var NORMAL_RULE = { rule_id: "vdh2", }; -var LOUD_RULE = { +const LOUD_RULE = { actions: [ "notify", { set_tweak: "highlight" }, @@ -43,7 +40,7 @@ var LOUD_RULE = { rule_id: "vdh2", }; -var USERNAME_RULE = { +const USERNAME_RULE = { actions: [ "notify", { set_tweak: "sound", value: "default" }, @@ -56,26 +53,25 @@ var USERNAME_RULE = { }; - describe("ContentRules", function() { describe("parseContentRules", function() { it("should handle there being no keyword rules", function() { - var rules = { 'global': { 'content': [ + const rules = { 'global': { 'content': [ USERNAME_RULE, ]}}; - var parsed = ContentRules.parseContentRules(rules); + const parsed = ContentRules.parseContentRules(rules); expect(parsed.rules).toEqual([]); expect(parsed.vectorState).toEqual(PushRuleVectorState.ON); expect(parsed.externalRules).toEqual([]); }); it("should parse regular keyword notifications", function() { - var rules = { 'global': { 'content': [ + const rules = { 'global': { 'content': [ NORMAL_RULE, USERNAME_RULE, ]}}; - var parsed = ContentRules.parseContentRules(rules); + const parsed = ContentRules.parseContentRules(rules); expect(parsed.rules.length).toEqual(1); expect(parsed.rules[0]).toEqual(NORMAL_RULE); expect(parsed.vectorState).toEqual(PushRuleVectorState.ON); @@ -83,12 +79,12 @@ describe("ContentRules", function() { }); it("should parse loud keyword notifications", function() { - var rules = { 'global': { 'content': [ + const rules = { 'global': { 'content': [ LOUD_RULE, USERNAME_RULE, ]}}; - var parsed = ContentRules.parseContentRules(rules); + const parsed = ContentRules.parseContentRules(rules); expect(parsed.rules.length).toEqual(1); expect(parsed.rules[0]).toEqual(LOUD_RULE); expect(parsed.vectorState).toEqual(PushRuleVectorState.LOUD); @@ -96,13 +92,13 @@ describe("ContentRules", function() { }); it("should parse mixed keyword notifications", function() { - var rules = { 'global': { 'content': [ + const rules = { 'global': { 'content': [ LOUD_RULE, NORMAL_RULE, USERNAME_RULE, ]}}; - var parsed = ContentRules.parseContentRules(rules); + const parsed = ContentRules.parseContentRules(rules); expect(parsed.rules.length).toEqual(1); expect(parsed.rules[0]).toEqual(LOUD_RULE); expect(parsed.vectorState).toEqual(PushRuleVectorState.LOUD); diff --git a/test/notifications/PushRuleVectorState-test.js b/test/notifications/PushRuleVectorState-test.js index ff0de3e470..1127675791 100644 --- a/test/notifications/PushRuleVectorState-test.js +++ b/test/notifications/PushRuleVectorState-test.js @@ -14,16 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. */ -var notifications = require('../../src/notifications'); +const notifications = require('../../src/notifications'); -var prvs = notifications.PushRuleVectorState; - -var expect = require('expect'); +const prvs = notifications.PushRuleVectorState; describe("PushRuleVectorState", function() { describe("contentRuleVectorStateKind", function() { - it("should understand normal notifications", function () { - var rule = { + it("should understand normal notifications", function() { + const rule = { actions: [ "notify", ], @@ -33,26 +31,26 @@ describe("PushRuleVectorState", function() { toEqual(prvs.ON); }); - it("should handle loud notifications", function () { - var rule = { + it("should handle loud notifications", function() { + const rule = { actions: [ "notify", { set_tweak: "highlight", value: true }, { set_tweak: "sound", value: "default" }, - ] + ], }; expect(prvs.contentRuleVectorStateKind(rule)). toEqual(prvs.LOUD); }); - it("should understand missing highlight.value", function () { - var rule = { + it("should understand missing highlight.value", function() { + const rule = { actions: [ "notify", { set_tweak: "highlight" }, { set_tweak: "sound", value: "default" }, - ] + ], }; expect(prvs.contentRuleVectorStateKind(rule)).