Skip to content

Commit 050a3ea

Browse files
author
GuustMetz
committed
add greater than now tests
1 parent 1365c7b commit 050a3ea

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

test/api/lhcFills.test.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -472,34 +472,35 @@ module.exports = () => {
472472

473473
it('should return 200 and an LHCFill array for runs duration filter, > 00:00:00', (done) => {
474474
request(server)
475-
.get('/api/lhcFills?page[offset]=0&page[limit]=15&filter[runDuration][operator]=>&filter[runDuration][limit]=00:00:00')
476-
.expect(200)
475+
.get('/api/lhcFills?page[offset]=0&page[limit]=15&filter[stableBeamsEnd][from]=2647867600000')
476+
.expect(400)
477477
.end((err, res) => {
478478
if (err) {
479479
done(err);
480480
return;
481481
}
482482

483-
expect(res.body.data).to.have.lengthOf(1);
484-
expect(res.body.data[0].fillNumber).to.equal(6);
485-
486-
done();
483+
const { errors: [error] } = res.body;
484+
expect(error.title).to.equal('Invalid Attribute');
485+
expect(error.detail).to.equal('"query.filter.stableBeamsEnd.from" must be less than "now"');
486+
done()
487487
});
488488
});
489489

490-
it('should return 200 and an LHCFill array for runs duration filter, < 00:00:00', (done) => {
490+
it('should return 400 when stableBeamStart filter "from" is greater than the current time', (done) => {
491491
request(server)
492-
.get('/api/lhcFills?page[offset]=0&page[limit]=15&filter[runDuration][operator]=<&filter[runDuration][limit]=00:00:00')
493-
.expect(200)
492+
.get('/api/lhcFills?page[offset]=0&page[limit]=15&filter[stableBeamsStart][from]=2647867600000')
493+
.expect(400)
494494
.end((err, res) => {
495495
if (err) {
496496
done(err);
497497
return;
498498
}
499499

500-
expect(res.body.data).to.have.lengthOf(0);
501-
502-
done();
500+
const { errors: [error] } = res.body;
501+
expect(error.title).to.equal('Invalid Attribute');
502+
expect(error.detail).to.equal('"query.filter.stableBeamsStart.from" must be less than "now"');
503+
done()
503504
});
504505
});
505506

0 commit comments

Comments
 (0)