[open-ils-commits] [GIT] Evergreen ILS branch master updated. 482c98453d97bec172c7b0a201baa2b81c0c97dc
Evergreen Git
git at git.evergreen-ils.org
Fri Mar 10 23:27:18 EST 2017
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, master has been updated
via 482c98453d97bec172c7b0a201baa2b81c0c97dc (commit)
from 7e46ea8bebb0352f56457104f420c923f0ecf2a7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 482c98453d97bec172c7b0a201baa2b81c0c97dc
Author: Bill Erickson <berickxx at gmail.com>
Date: Fri Mar 10 13:55:09 2017 -0500
LP#1671904 egDate unit test handles time change
Teach the egDate unit test requesting '2 days' worth of seconds to allow
values for 47, 48, or 49 hours. 47 and 49 happen when crossing time
change boundaries.
Signed-off-by: Bill Erickson <berickxx at gmail.com>
Signed-off-by: Kathy Lussier <klussier at masslnc.org>
diff --git a/Open-ILS/web/js/ui/default/staff/services/date.js b/Open-ILS/web/js/ui/default/staff/services/date.js
index 629b799..781b4c4 100644
--- a/Open-ILS/web/js/ui/default/staff/services/date.js
+++ b/Open-ILS/web/js/ui/default/staff/services/date.js
@@ -14,7 +14,7 @@ angular.module('egCoreMod')
* Converts an interval string to seconds.
*
* egDate.intervalToSeconds('1 min 2 seconds')) => 62
- * egDate.intervalToSeconds('2 days')) => 172800
+ * egDate.intervalToSeconds('2 days')) => 172800 (except across time changes)
* egDate.intervalToSeconds('02:00:23')) => 7223
*/
service.intervalToSeconds = function(interval) {
diff --git a/Open-ILS/web/js/ui/default/staff/test/unit/egDate.js b/Open-ILS/web/js/ui/default/staff/test/unit/egDate.js
index f55fe9f..5802e2d 100644
--- a/Open-ILS/web/js/ui/default/staff/test/unit/egDate.js
+++ b/Open-ILS/web/js/ui/default/staff/test/unit/egDate.js
@@ -3,8 +3,34 @@
describe('egDate', function(){
beforeEach(module('egCoreMod'));
+ beforeEach(function () {
+ this.addMatchers({
+
+ // "2 days" may be 47, 48, or 49 hours depending on the
+ // proximity to and direction of a time change event.
+ // This does not take leap seconds into account.
+ toBe2DaysOfSeconds: function () {
+ var actual = this.actual;
+ var hours_47 = 169200;
+ var hours_48 = 172800;
+ var hours_49 = 176400;
+
+ this.message = function () {
+ return "Expected " + actual + " to be " +
+ hours_47 + ", " + hours_48 + ", or " + hours_49;
+ };
+
+ return (
+ actual == hours_47 ||
+ actual == hours_48 ||
+ actual == hours_49
+ );
+ }
+ });
+ });
+
it('should parse a simple interval', inject(function(egDate) {
- expect(egDate.intervalToSeconds('2 days')).toBe(172800);
+ expect(egDate.intervalToSeconds('2 days')).toBe2DaysOfSeconds();
}));
it('should parse a combined interval', inject(function(egDate) {
-----------------------------------------------------------------------
Summary of changes:
Open-ILS/web/js/ui/default/staff/services/date.js | 2 +-
.../web/js/ui/default/staff/test/unit/egDate.js | 28 +++++++++++++++++++-
2 files changed, 28 insertions(+), 2 deletions(-)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list