Remove tests, fix lint, update packages

This commit is contained in:
Pavel Djundik 2018-09-12 21:09:43 +03:00
commit dd686b563d
3 changed files with 6 additions and 49 deletions

View file

@ -1,24 +0,0 @@
"use strict";
const expect = require("chai").expect;
const moment = require("moment");
const friendlydate = require("../../../../../client/js/libs/handlebars/friendlydate");
describe("friendlydate Handlebars helper", () => {
it("should render 'Today' as a human-friendly date", () => {
const time = new Date().getTime();
expect(friendlydate(time)).to.equal("Today");
});
it("should render 'Yesterday' as a human-friendly date", () => {
const time = new Date().getTime() - 24 * 3600 * 1000;
expect(friendlydate(time)).to.equal("Yesterday");
});
it("should not render any friendly dates prior to the day before", () => {
[2, 7, 30, 365, 1000].forEach((day) => {
const time = new Date().getTime() - 24 * 3600 * 1000 * day;
expect(friendlydate(time)).to.equal(moment(time).format("D MMMM YYYY"));
});
});
});

View file

@ -1,19 +0,0 @@
"use strict";
const expect = require("chai").expect;
const localedate = require("../../../../../client/js/libs/handlebars/localedate");
describe("localedate Handlebars helper", function() {
it("should render a human-readable date", function() {
// 12PM in UTC time
const date = new Date("2014-05-22T12:00:00Z");
// Offset between UTC and local timezone
const offset = date.getTimezoneOffset() * 60 * 1000;
// Pretend local timezone is UTC by moving the clock of that offset
const time = date.getTime() + offset;
expect(localedate(time)).to.equal("22 May 2014");
});
});