This repository has been archived by the owner on Dec 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
69 lines (63 loc) · 2.06 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
'use strict';
var vows = require('perjury'),
assert = vows.assert;
vows.describe('roberts-rules module').addBatch({
'When we require the module': {
topic: function() {
return require('./index');
},
'it works': function(err, robertsRules) {
assert.ifError(err);
assert.isFunction(robertsRules);
},
'and we create a new meeting instance': {
topic: function(robertsRules) {
return robertsRules();
},
'it works': function(err, meeting) {
assert.ifError(err);
assert.isObject(meeting);
},
'it has the properties we expect': function(err, meeting) {
// TODO tighten
assert.isNull(meeting.speaker);
assert.isArray(meeting.speakerList);
assert.isArray(meeting.attendeeList);
},
'it has the methods we expect': function(err, meeting) {
assert.isFunction(meeting.addAttendee);
assert.isFunction(meeting.removeAttendee);
assert.isFunction(meeting.queueSpeaker);
assert.isFunction(meeting.dequeueSpeaker);
assert.isFunction(meeting.ackSpeaker);
assert.isFunction(meeting.yieldSpeaker);
assert.isFunction(meeting.motionToClose);
assert.isFunction(meeting.motionToTimebox);
assert.isFunction(meeting.motionToAdjourn);
assert.isFunction(meeting.secondMotion);
assert.isFunction(meeting.pointOfOrder);
assert.isFunction(meeting.pointOfClarification);
assert.isFunction(meeting.castYea);
assert.isFunction(meeting.castNay);
assert.isFunction(meeting.castAbstain);
},
'and we mark Alice and Bob as present': {
topic: function(meeting) {
meeting.addAttendee('Alice');
meeting.addAttendee('Bob');
return meeting;
},
'it works': function(err, meeting) {
assert.ifError(err);
assert.isObject(meeting);
},
'Alice and Bob are in the attendee list': function(err, meeting) {
assert.equal(meeting.attendeeList.length, 2);
// TODO figure out why assert.includes() doesn't work here
assert(meeting.attendeeList.includes('Alice'));
assert(meeting.attendeeList.includes('Bob'));
}
}
}
}
}).export(module);