Merge pull request #5377 from matrix-org/dbkr/for_want_of_a_const

Remove a couple more files from eslintignore
This commit is contained in:
David Baker 2020-10-30 18:45:20 +00:00 committed by GitHub
commit 6d2dc63e47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 32 deletions

View file

@ -12,8 +12,6 @@ src/utils/MultiInviter.js
test/components/structures/MessagePanel-test.js test/components/structures/MessagePanel-test.js
test/components/views/dialogs/InteractiveAuthDialog-test.js test/components/views/dialogs/InteractiveAuthDialog-test.js
test/mock-clock.js test/mock-clock.js
test/notifications/ContentRules-test.js
test/notifications/PushRuleVectorState-test.js
src/component-index.js src/component-index.js
test/end-to-end-tests/node_modules/ test/end-to-end-tests/node_modules/
test/end-to-end-tests/riot/ test/end-to-end-tests/riot/

View file

@ -14,15 +14,12 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
var notifications = require('../../src/notifications'); const notifications = require('../../src/notifications');
var ContentRules = notifications.ContentRules; const ContentRules = notifications.ContentRules;
var PushRuleVectorState = notifications.PushRuleVectorState; const PushRuleVectorState = notifications.PushRuleVectorState;
var expect = require('expect'); const NORMAL_RULE = {
var test_utils = require('../test-utils');
var NORMAL_RULE = {
actions: [ actions: [
"notify", "notify",
{ set_tweak: "highlight", value: false }, { set_tweak: "highlight", value: false },
@ -32,7 +29,7 @@ var NORMAL_RULE = {
rule_id: "vdh2", rule_id: "vdh2",
}; };
var LOUD_RULE = { const LOUD_RULE = {
actions: [ actions: [
"notify", "notify",
{ set_tweak: "highlight" }, { set_tweak: "highlight" },
@ -43,7 +40,7 @@ var LOUD_RULE = {
rule_id: "vdh2", rule_id: "vdh2",
}; };
var USERNAME_RULE = { const USERNAME_RULE = {
actions: [ actions: [
"notify", "notify",
{ set_tweak: "sound", value: "default" }, { set_tweak: "sound", value: "default" },
@ -56,26 +53,25 @@ var USERNAME_RULE = {
}; };
describe("ContentRules", function() { describe("ContentRules", function() {
describe("parseContentRules", function() { describe("parseContentRules", function() {
it("should handle there being no keyword rules", function() { it("should handle there being no keyword rules", function() {
var rules = { 'global': { 'content': [ const rules = { 'global': { 'content': [
USERNAME_RULE, USERNAME_RULE,
]}}; ]}};
var parsed = ContentRules.parseContentRules(rules); const parsed = ContentRules.parseContentRules(rules);
expect(parsed.rules).toEqual([]); expect(parsed.rules).toEqual([]);
expect(parsed.vectorState).toEqual(PushRuleVectorState.ON); expect(parsed.vectorState).toEqual(PushRuleVectorState.ON);
expect(parsed.externalRules).toEqual([]); expect(parsed.externalRules).toEqual([]);
}); });
it("should parse regular keyword notifications", function() { it("should parse regular keyword notifications", function() {
var rules = { 'global': { 'content': [ const rules = { 'global': { 'content': [
NORMAL_RULE, NORMAL_RULE,
USERNAME_RULE, USERNAME_RULE,
]}}; ]}};
var parsed = ContentRules.parseContentRules(rules); const parsed = ContentRules.parseContentRules(rules);
expect(parsed.rules.length).toEqual(1); expect(parsed.rules.length).toEqual(1);
expect(parsed.rules[0]).toEqual(NORMAL_RULE); expect(parsed.rules[0]).toEqual(NORMAL_RULE);
expect(parsed.vectorState).toEqual(PushRuleVectorState.ON); expect(parsed.vectorState).toEqual(PushRuleVectorState.ON);
@ -83,12 +79,12 @@ describe("ContentRules", function() {
}); });
it("should parse loud keyword notifications", function() { it("should parse loud keyword notifications", function() {
var rules = { 'global': { 'content': [ const rules = { 'global': { 'content': [
LOUD_RULE, LOUD_RULE,
USERNAME_RULE, USERNAME_RULE,
]}}; ]}};
var parsed = ContentRules.parseContentRules(rules); const parsed = ContentRules.parseContentRules(rules);
expect(parsed.rules.length).toEqual(1); expect(parsed.rules.length).toEqual(1);
expect(parsed.rules[0]).toEqual(LOUD_RULE); expect(parsed.rules[0]).toEqual(LOUD_RULE);
expect(parsed.vectorState).toEqual(PushRuleVectorState.LOUD); expect(parsed.vectorState).toEqual(PushRuleVectorState.LOUD);
@ -96,13 +92,13 @@ describe("ContentRules", function() {
}); });
it("should parse mixed keyword notifications", function() { it("should parse mixed keyword notifications", function() {
var rules = { 'global': { 'content': [ const rules = { 'global': { 'content': [
LOUD_RULE, LOUD_RULE,
NORMAL_RULE, NORMAL_RULE,
USERNAME_RULE, USERNAME_RULE,
]}}; ]}};
var parsed = ContentRules.parseContentRules(rules); const parsed = ContentRules.parseContentRules(rules);
expect(parsed.rules.length).toEqual(1); expect(parsed.rules.length).toEqual(1);
expect(parsed.rules[0]).toEqual(LOUD_RULE); expect(parsed.rules[0]).toEqual(LOUD_RULE);
expect(parsed.vectorState).toEqual(PushRuleVectorState.LOUD); expect(parsed.vectorState).toEqual(PushRuleVectorState.LOUD);

View file

@ -14,16 +14,14 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
var notifications = require('../../src/notifications'); const notifications = require('../../src/notifications');
var prvs = notifications.PushRuleVectorState; const prvs = notifications.PushRuleVectorState;
var expect = require('expect');
describe("PushRuleVectorState", function() { describe("PushRuleVectorState", function() {
describe("contentRuleVectorStateKind", function() { describe("contentRuleVectorStateKind", function() {
it("should understand normal notifications", function () { it("should understand normal notifications", function() {
var rule = { const rule = {
actions: [ actions: [
"notify", "notify",
], ],
@ -33,26 +31,26 @@ describe("PushRuleVectorState", function() {
toEqual(prvs.ON); toEqual(prvs.ON);
}); });
it("should handle loud notifications", function () { it("should handle loud notifications", function() {
var rule = { const rule = {
actions: [ actions: [
"notify", "notify",
{ set_tweak: "highlight", value: true }, { set_tweak: "highlight", value: true },
{ set_tweak: "sound", value: "default" }, { set_tweak: "sound", value: "default" },
] ],
}; };
expect(prvs.contentRuleVectorStateKind(rule)). expect(prvs.contentRuleVectorStateKind(rule)).
toEqual(prvs.LOUD); toEqual(prvs.LOUD);
}); });
it("should understand missing highlight.value", function () { it("should understand missing highlight.value", function() {
var rule = { const rule = {
actions: [ actions: [
"notify", "notify",
{ set_tweak: "highlight" }, { set_tweak: "highlight" },
{ set_tweak: "sound", value: "default" }, { set_tweak: "sound", value: "default" },
] ],
}; };
expect(prvs.contentRuleVectorStateKind(rule)). expect(prvs.contentRuleVectorStateKind(rule)).