Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jupe committed Aug 21, 2018
1 parent b0ebda7 commit eb01f09
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion test/api/events.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const assert = require('assert');
const moxios = require('moxios');

const {Transport, Event} = require('../../src');
const {Transport, Event, Events} = require('../../src');

describe('Event', function () {
let transport;
Expand All @@ -24,12 +24,24 @@ describe('Event', function () {
const res = new Event(transport, toBe);
assert.deepEqual(res.toJson(), toBe);
});
it('create event from events', function () {
const events = new Events(transport);
const res = events.create();
assert.equal(res.isNew, true);
});
it('call setters', function () {
const res = new Event(transport, {_id: '123'});
assert.equal(res.isDirty(), false);
res
.alert()
.facility('resource')
.allocated()
.released()
.enterMaintenance()
.exitMaintenance()
.created()
.deleted()
.flashed()
.allocated();
assert.equal(res.isDirty(), true);
const toBe = {_id: '123', priority: {level: 'alert', facility: 'resource'}, msgid: 'ALLOCATED'};
Expand Down

0 comments on commit eb01f09

Please sign in to comment.