Commit aea1d8b5 authored by Farid Neshat's avatar Farid Neshat

Fix timeoff formatting

parent e0a91f3c
......@@ -111,12 +111,12 @@ module.exports = function(robot) {
options.start = options.end = utils.serializeDate(options.start);
} else {
if (options.start) {
query.push('from', utils.formatDate(options.from));
query.push('from', utils.formatDate(options.start));
options.start = utils.serializeDate(options.start);
}
if (options.end) {
query.push('to', utils.formatDate(options.from));
query.push('to', utils.formatDate(options.end));
options.end = utils.serializeDate(options.end);
}
}
......
......@@ -239,7 +239,8 @@ describe('Show', function() {
});
it('from', function () {
return this.room.user.say('bob', 'hubot show leave time-off from tomorrow').then(() => {
expect(this.room.messages[1][1]).to.be.equal('Searching for pending time-offs from Sat Jul 1');
expect(this.room.messages[1][1]).to.be.equal('Searching for pending time-offs from Sun' +
' Jul 2');
expect(Bamboohr.prototype.timeOffRequests).to.have.been.calledWith({
status: 'requested',
start: "2017-07-02",
......@@ -298,6 +299,18 @@ describe('Show', function() {
'Farid has a pending sick leave from *Mon Oct 3 2011* to *Sat Oct 1* for 5 working days with id of 2');
});
});
it('from', function () {
return this.room.user.say('bob', 'hubot show leave time-off from 1 Jan 2017 to 1 Jan' +
' 2018').then(() => {
expect(this.room.messages[1][1]).to.be.equal('Searching for pending time-offs from Sun' +
' Jan 1 to Mon Jan 1');
expect(Bamboohr.prototype.timeOffRequests).to.have.been.calledWith({
status: 'requested',
start: "2017-01-01",
end: "2018-01-01",
});
});
});
});
});
describe.skip('approve timeoffs', function () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment