Apply prettier formatting
This commit is contained in:
parent
1cac306093
commit
526645c791
1576 changed files with 65385 additions and 62478 deletions
|
@ -20,10 +20,7 @@ import { TweakName, PushRuleActionName, TweakHighlight, TweakSound } from "matri
|
|||
import { ContentRules, PushRuleVectorState } from "../../src/notifications";
|
||||
|
||||
const NORMAL_RULE = {
|
||||
actions: [
|
||||
PushRuleActionName.Notify,
|
||||
{ set_tweak: TweakName.Highlight, value: false } as TweakHighlight,
|
||||
],
|
||||
actions: [PushRuleActionName.Notify, { set_tweak: TweakName.Highlight, value: false } as TweakHighlight],
|
||||
default: false,
|
||||
enabled: true,
|
||||
pattern: "vdh2",
|
||||
|
@ -54,23 +51,18 @@ const USERNAME_RULE = {
|
|||
rule_id: ".m.rule.contains_user_name",
|
||||
};
|
||||
|
||||
describe("ContentRules", function() {
|
||||
describe("parseContentRules", function() {
|
||||
it("should handle there being no keyword rules", function() {
|
||||
const rules = { 'global': { 'content': [
|
||||
USERNAME_RULE,
|
||||
] } };
|
||||
describe("ContentRules", function () {
|
||||
describe("parseContentRules", function () {
|
||||
it("should handle there being no keyword rules", function () {
|
||||
const rules = { global: { content: [USERNAME_RULE] } };
|
||||
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() {
|
||||
const rules = { 'global': { 'content': [
|
||||
NORMAL_RULE,
|
||||
USERNAME_RULE,
|
||||
] } };
|
||||
it("should parse regular keyword notifications", function () {
|
||||
const rules = { global: { content: [NORMAL_RULE, USERNAME_RULE] } };
|
||||
|
||||
const parsed = ContentRules.parseContentRules(rules);
|
||||
expect(parsed.rules.length).toEqual(1);
|
||||
|
@ -79,11 +71,8 @@ describe("ContentRules", function() {
|
|||
expect(parsed.externalRules).toEqual([]);
|
||||
});
|
||||
|
||||
it("should parse loud keyword notifications", function() {
|
||||
const rules = { 'global': { 'content': [
|
||||
LOUD_RULE,
|
||||
USERNAME_RULE,
|
||||
] } };
|
||||
it("should parse loud keyword notifications", function () {
|
||||
const rules = { global: { content: [LOUD_RULE, USERNAME_RULE] } };
|
||||
|
||||
const parsed = ContentRules.parseContentRules(rules);
|
||||
expect(parsed.rules.length).toEqual(1);
|
||||
|
@ -92,12 +81,8 @@ describe("ContentRules", function() {
|
|||
expect(parsed.externalRules).toEqual([]);
|
||||
});
|
||||
|
||||
it("should parse mixed keyword notifications", function() {
|
||||
const rules = { 'global': { 'content': [
|
||||
LOUD_RULE,
|
||||
NORMAL_RULE,
|
||||
USERNAME_RULE,
|
||||
] } };
|
||||
it("should parse mixed keyword notifications", function () {
|
||||
const rules = { global: { content: [LOUD_RULE, NORMAL_RULE, USERNAME_RULE] } };
|
||||
|
||||
const parsed = ContentRules.parseContentRules(rules);
|
||||
expect(parsed.rules.length).toEqual(1);
|
||||
|
|
|
@ -15,32 +15,24 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
PushRuleActionName,
|
||||
TweakHighlight,
|
||||
TweakName,
|
||||
TweakSound,
|
||||
} from "matrix-js-sdk/src/matrix";
|
||||
import { PushRuleActionName, TweakHighlight, TweakName, TweakSound } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { PushRuleVectorState } from "../../src/notifications";
|
||||
|
||||
describe("PushRuleVectorState", function() {
|
||||
describe("contentRuleVectorStateKind", function() {
|
||||
it("should understand normal notifications", function() {
|
||||
describe("PushRuleVectorState", function () {
|
||||
describe("contentRuleVectorStateKind", function () {
|
||||
it("should understand normal notifications", function () {
|
||||
const rule = {
|
||||
actions: [
|
||||
PushRuleActionName.Notify,
|
||||
],
|
||||
actions: [PushRuleActionName.Notify],
|
||||
default: false,
|
||||
enabled: false,
|
||||
rule_id: '1',
|
||||
rule_id: "1",
|
||||
};
|
||||
|
||||
expect(PushRuleVectorState.contentRuleVectorStateKind(rule)).
|
||||
toEqual(PushRuleVectorState.ON);
|
||||
expect(PushRuleVectorState.contentRuleVectorStateKind(rule)).toEqual(PushRuleVectorState.ON);
|
||||
});
|
||||
|
||||
it("should handle loud notifications", function() {
|
||||
it("should handle loud notifications", function () {
|
||||
const rule = {
|
||||
actions: [
|
||||
PushRuleActionName.Notify,
|
||||
|
@ -49,14 +41,13 @@ describe("PushRuleVectorState", function() {
|
|||
],
|
||||
default: false,
|
||||
enabled: false,
|
||||
rule_id: '1',
|
||||
rule_id: "1",
|
||||
};
|
||||
|
||||
expect(PushRuleVectorState.contentRuleVectorStateKind(rule)).
|
||||
toEqual(PushRuleVectorState.LOUD);
|
||||
expect(PushRuleVectorState.contentRuleVectorStateKind(rule)).toEqual(PushRuleVectorState.LOUD);
|
||||
});
|
||||
|
||||
it("should understand missing highlight.value", function() {
|
||||
it("should understand missing highlight.value", function () {
|
||||
const rule = {
|
||||
actions: [
|
||||
PushRuleActionName.Notify,
|
||||
|
@ -65,11 +56,10 @@ describe("PushRuleVectorState", function() {
|
|||
],
|
||||
default: false,
|
||||
enabled: false,
|
||||
rule_id: '1',
|
||||
rule_id: "1",
|
||||
};
|
||||
|
||||
expect(PushRuleVectorState.contentRuleVectorStateKind(rule)).
|
||||
toEqual(PushRuleVectorState.LOUD);
|
||||
expect(PushRuleVectorState.contentRuleVectorStateKind(rule)).toEqual(PushRuleVectorState.LOUD);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue