Index: test/notification.js |
diff --git a/test/notification.js b/test/notification.js |
index 6e6ec9fc813193d8f36d880a86ed9fec01a5a8d4..7976c1668b4d88bd8f8a5daf67a7e1bc60748b02 100644 |
--- a/test/notification.js |
+++ b/test/notification.js |
@@ -371,6 +371,29 @@ exports.testURLSpecificNotification = function(test) |
}).catch(unexpectedError.bind(test)).then(() => test.done()); |
}; |
+exports.testInterval = function(test) { |
Felix Dahlke
2017/01/19 17:16:14
Nit: Opening brace should be on the next line
Felix Dahlke
2017/01/19 17:16:14
How about writing a second test that combines a re
wspee
2017/01/20 09:21:40
Done.
wspee
2017/01/20 09:21:40
Done.
|
+ let relentless = { |
+ id: 3, |
+ type: "relentless", |
+ interval: 100 |
+ }; |
+ |
+ registerHandler.call(this, [relentless]); |
+ this.runScheduledTasks(1).then(() => |
+ { |
+ test.deepEqual(showNotifications(), [relentless], "Relentless notifications are not shown initially"); |
Felix Dahlke
2017/01/19 17:16:14
Seems like the description here describes the situ
wspee
2017/01/20 09:21:40
Done.
|
+ }).then(() => |
+ { |
+ test.deepEqual(showNotifications(), [], "Relentless notifications are shown before interval"); |
+ }).then(() => |
+ { |
+ // Date always returns a fixed time (see setupTimerAndXMLHttp) so we |
+ // manipulate the shown data manually. |
+ Prefs.notificationdata.shown[relentless.id] -= relentless.interval; |
+ test.deepEqual(showNotifications(), [relentless], "Relentless notifications are not ignored"); |
Felix Dahlke
2017/01/19 17:16:14
Description nit: "Relentless notifications are sho
wspee
2017/01/20 09:21:40
Done.
|
+ }).catch(unexpectedError.bind(test)).then(() => test.done()); |
+}; |
+ |
exports.testGlobalOptOut = function(test) |
{ |
Notification.toggleIgnoreCategory("*", true); |
@@ -402,6 +425,10 @@ exports.testGlobalOptOut = function(test) |
id: 2, |
type: "critical" |
}; |
+ let relentless = { |
+ id: 3, |
+ type: "relentless" |
+ }; |
Notification.toggleIgnoreCategory("*", true); |
registerHandler.call(this, [information]); |
@@ -418,6 +445,13 @@ exports.testGlobalOptOut = function(test) |
}).then(() => |
{ |
test.deepEqual(showNotifications(), [critical], "Critical notifications are not ignored"); |
+ |
+ Prefs.notificationdata = {}; |
+ registerHandler.call(this, [relentless]); |
+ return this.runScheduledTasks(1); |
+ }).then(() => |
+ { |
+ test.deepEqual(showNotifications(), [relentless], "Relentless notifications are not ignored"); |
}).catch(unexpectedError.bind(test)).then(() => test.done()); |
}; |