-
Notifications
You must be signed in to change notification settings - Fork 0
/
two-bucket.spec.js
47 lines (41 loc) · 1.68 KB
/
two-bucket.spec.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
var TwoBucket = require('./two-bucket');
describe('TwoBucket', function(){
describe('works for input of 3,5,1', function(){
var buckOne = 3;
var buckTwo = 5;
var goal = 1;
it('starting with bucket one', function(){
var starterBuck = 'one'; //indicates which bucket to fill first
var twoBucket = new TwoBucket(buckOne,buckTwo,goal,starterBuck);
expect(twoBucket.moves()).toEqual(4); //includes the first fill
expect(twoBucket.goalBucket).toEqual('one'); //which bucket should end up with the desired # of liters
expect(twoBucket.otherBucket).toEqual(5); //leftover value in the "other" bucket once the goal has been reached
});
xit('starting with bucket two', function(){
var starterBuck = 'two';
var twoBucket = new TwoBucket(buckOne,buckTwo,goal,starterBuck);
expect(twoBucket.moves()).toEqual(8);
expect(twoBucket.goalBucket).toEqual('two');
expect(twoBucket.otherBucket).toEqual(3);
});
});
describe('works for input of 7,11,2', function(){
var buckOne = 7;
var buckTwo = 11;
var goal = 2;
xit('starting with bucket one', function(){
var starterBuck = 'one';
var twoBucket = new TwoBucket(buckOne,buckTwo,goal,starterBuck);
expect(twoBucket.moves()).toEqual(14);
expect(twoBucket.goalBucket).toEqual('one');
expect(twoBucket.otherBucket).toEqual(11);
});
xit('starting with bucket two', function(){
var starterBuck = 'two';
var twoBucket = new TwoBucket(buckOne,buckTwo,goal,starterBuck);
expect(twoBucket.moves()).toEqual(18);
expect(twoBucket.goalBucket).toEqual('two');
expect(twoBucket.otherBucket).toEqual(7);
});
});
});