parent
7ec1d5a881
commit
db0d74d0d4
|
@ -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/
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)).
|
||||
|
|
Loading…
Reference in New Issue