mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
Add (failing) test for new date field
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
const helpers = require("../global-setup");
|
||||
const expect = require("chai").expect;
|
||||
const moment = require("moment");
|
||||
|
||||
const describe = global.describe;
|
||||
const it = global.it;
|
||||
@@ -89,4 +90,40 @@ describe("Compliments module", function() {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Feature date in compliments module", function() {
|
||||
describe("Set date and empty compliments for anytime, morning, evening and afternoon", function() {
|
||||
let RealDate;
|
||||
|
||||
before(function() {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/compliments/compliments_date.js";
|
||||
|
||||
RealDate = Date;
|
||||
let customTimeMs = moment("2015-10-12T06:00:00.000Z").valueOf();
|
||||
|
||||
function MockDate() {
|
||||
return new RealDate(customTimeMs);
|
||||
}
|
||||
|
||||
MockDate.now = function () {
|
||||
return new MockDate().valueOf();
|
||||
};
|
||||
|
||||
MockDate.prototype = RealDate.prototype;
|
||||
|
||||
Date = MockDate;
|
||||
});
|
||||
|
||||
it("Show anytime because if configure empty parts of day compliments and set anytime compliments", function() {
|
||||
return app.client.waitUntilWindowLoaded().getText(".compliments").then(function(text) {
|
||||
expect(text).to.be.oneOf(["Happy birthday, Ada Lovelace!"]);
|
||||
});
|
||||
});
|
||||
|
||||
after(function() {
|
||||
Date = RealDate;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user