@@ -14,15 +14,12 @@ See the License for the specific language governing permissions and
1414limitations under the License.
1515*/
1616
17- var notifications = require ( '../../src/notifications' ) ;
17+ const notifications = require ( '../../src/notifications' ) ;
1818
19- var ContentRules = notifications . ContentRules ;
20- var PushRuleVectorState = notifications . PushRuleVectorState ;
19+ const ContentRules = notifications . ContentRules ;
20+ const PushRuleVectorState = notifications . PushRuleVectorState ;
2121
22- var expect = require ( 'expect' ) ;
23- var test_utils = require ( '../test-utils' ) ;
24-
25- var NORMAL_RULE = {
22+ const NORMAL_RULE = {
2623 actions : [
2724 "notify" ,
2825 { set_tweak : "highlight" , value : false } ,
@@ -32,7 +29,7 @@ var NORMAL_RULE = {
3229 rule_id : "vdh2" ,
3330} ;
3431
35- var LOUD_RULE = {
32+ const LOUD_RULE = {
3633 actions : [
3734 "notify" ,
3835 { set_tweak : "highlight" } ,
@@ -43,7 +40,7 @@ var LOUD_RULE = {
4340 rule_id : "vdh2" ,
4441} ;
4542
46- var USERNAME_RULE = {
43+ const USERNAME_RULE = {
4744 actions : [
4845 "notify" ,
4946 { set_tweak : "sound" , value : "default" } ,
@@ -56,53 +53,52 @@ var USERNAME_RULE = {
5653} ;
5754
5855
59-
6056describe ( "ContentRules" , function ( ) {
6157 describe ( "parseContentRules" , function ( ) {
6258 it ( "should handle there being no keyword rules" , function ( ) {
63- var rules = { 'global' : { 'content' : [
59+ const rules = { 'global' : { 'content' : [
6460 USERNAME_RULE ,
6561 ] } } ;
66- var parsed = ContentRules . parseContentRules ( rules ) ;
62+ const parsed = ContentRules . parseContentRules ( rules ) ;
6763 expect ( parsed . rules ) . toEqual ( [ ] ) ;
6864 expect ( parsed . vectorState ) . toEqual ( PushRuleVectorState . ON ) ;
6965 expect ( parsed . externalRules ) . toEqual ( [ ] ) ;
7066 } ) ;
7167
7268 it ( "should parse regular keyword notifications" , function ( ) {
73- var rules = { 'global' : { 'content' : [
69+ const rules = { 'global' : { 'content' : [
7470 NORMAL_RULE ,
7571 USERNAME_RULE ,
7672 ] } } ;
7773
78- var parsed = ContentRules . parseContentRules ( rules ) ;
74+ const parsed = ContentRules . parseContentRules ( rules ) ;
7975 expect ( parsed . rules . length ) . toEqual ( 1 ) ;
8076 expect ( parsed . rules [ 0 ] ) . toEqual ( NORMAL_RULE ) ;
8177 expect ( parsed . vectorState ) . toEqual ( PushRuleVectorState . ON ) ;
8278 expect ( parsed . externalRules ) . toEqual ( [ ] ) ;
8379 } ) ;
8480
8581 it ( "should parse loud keyword notifications" , function ( ) {
86- var rules = { 'global' : { 'content' : [
82+ const rules = { 'global' : { 'content' : [
8783 LOUD_RULE ,
8884 USERNAME_RULE ,
8985 ] } } ;
9086
91- var parsed = ContentRules . parseContentRules ( rules ) ;
87+ const parsed = ContentRules . parseContentRules ( rules ) ;
9288 expect ( parsed . rules . length ) . toEqual ( 1 ) ;
9389 expect ( parsed . rules [ 0 ] ) . toEqual ( LOUD_RULE ) ;
9490 expect ( parsed . vectorState ) . toEqual ( PushRuleVectorState . LOUD ) ;
9591 expect ( parsed . externalRules ) . toEqual ( [ ] ) ;
9692 } ) ;
9793
9894 it ( "should parse mixed keyword notifications" , function ( ) {
99- var rules = { 'global' : { 'content' : [
95+ const rules = { 'global' : { 'content' : [
10096 LOUD_RULE ,
10197 NORMAL_RULE ,
10298 USERNAME_RULE ,
10399 ] } } ;
104100
105- var parsed = ContentRules . parseContentRules ( rules ) ;
101+ const parsed = ContentRules . parseContentRules ( rules ) ;
106102 expect ( parsed . rules . length ) . toEqual ( 1 ) ;
107103 expect ( parsed . rules [ 0 ] ) . toEqual ( LOUD_RULE ) ;
108104 expect ( parsed . vectorState ) . toEqual ( PushRuleVectorState . LOUD ) ;
0 commit comments