Skip to content

Commit

Permalink
Change help for device command and fromDate
Browse files Browse the repository at this point in the history
  • Loading branch information
bargenson committed Feb 2, 2017
1 parent d93f08b commit a746174
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion clients/Barracks.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class Barracks {
getSegmentByName(token, segmentName) {
return new Promise((resolve, reject) => {
this.getSegments(token).then(segments => {
const segment = segments.active.find(segment => {
const segment = segments.active.concat(segments.other).find(segment => {
return segment.name === segmentName;
});
if (segment) {
Expand Down
20 changes: 19 additions & 1 deletion clients/Barracks.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,25 @@ describe('Barracks', () => {
// Given
const segmentName = 'segment prod';
const segment = { id: 'lkjhgfdsa', name: segmentName };
const response = { active: [ segment, { id: 'zxcvbnm', name: 'other segment' } ] };
const response = { active: [ segment, { id: 'zxcvbnm', name: 'other segment' } ], other: { id: 'other', name: 'Other' } };
barracks.getSegments = sinon.stub().returns(Promise.resolve(response));

// When / Then
barracks.getSegmentByName(token, segmentName).then(result => {
expect(result).to.be.equals(segment);
expect(barracks.getSegments).to.have.been.calledOnce;
expect(barracks.getSegments).to.have.been.calledWithExactly(token);
done();
}).catch(err => {
done(err);
});
});

it('should return other segment when name is other when request succeed', done => {
// Given
const segmentName = 'Other';
const segment = { id: 'other', name: segmentName };
const response = { active: [ { id: 'zxcvbnm', name: 'other segment' } ], other: segment };
barracks.getSegments = sinon.stub().returns(Promise.resolve(response));

// When / Then
Expand Down
2 changes: 1 addition & 1 deletion commands/DeviceCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class DeviceCommand extends BarracksCommand {
configureCommand(program) {
return program
.arguments('<unit-id>')
.option('--fromDate [\'YYYY-MM-DD\' | \'YYYY-MM-DDTHH:mm:ss.sssZ\']', '(Optionnal) The date (ISO-8601) from when to begin the history.');
.option('--fromDate [\'YYYY-MM-DD\' | \'YYYY-MM-DD HH:mm\' | \'YYYY-MM-DDTHH:mm:ss.sssZ\']', '(Optionnal) The date from when to begin the history');
}

validateCommand(program) {
Expand Down

0 comments on commit a746174

Please sign in to comment.