1
- import TwoBucket from './two-bucket' ;
1
+ import { TwoBucket , Bucket } from './two-bucket'
2
2
3
3
describe ( 'TwoBucket' , ( ) => {
4
4
describe ( 'works for input of 3, 5, 1' , ( ) => {
@@ -7,15 +7,15 @@ describe('TwoBucket', () => {
7
7
const goal = 1
8
8
9
9
test ( 'starting with bucket one' , ( ) => {
10
- const starterBuck = 'one' ; // indicates which bucket to fill first
10
+ const starterBuck = Bucket . One // indicates which bucket to fill first
11
11
const twoBucket = new TwoBucket ( buckOne , buckTwo , goal , starterBuck )
12
12
expect ( twoBucket . moves ( ) ) . toEqual ( 4 ) // includes the first fill
13
13
expect ( twoBucket . goalBucket ) . toEqual ( 'one' ) // which bucket should end up with the desired # of liters
14
14
expect ( twoBucket . otherBucket ) . toEqual ( 5 ) // leftover value in the "other" bucket once the goal has been reached
15
- } ) ;
15
+ } )
16
16
17
17
xtest ( 'starting with bucket two' , ( ) => {
18
- const starterBuck = 'two'
18
+ const starterBuck = Bucket . Two
19
19
const twoBucket = new TwoBucket ( buckOne , buckTwo , goal , starterBuck )
20
20
expect ( twoBucket . moves ( ) ) . toEqual ( 8 )
21
21
expect ( twoBucket . goalBucket ) . toEqual ( 'two' )
@@ -29,15 +29,15 @@ describe('TwoBucket', () => {
29
29
const goal = 2
30
30
31
31
xtest ( 'starting with bucket one' , ( ) => {
32
- const starterBuck = 'one'
32
+ const starterBuck = Bucket . One
33
33
const twoBucket = new TwoBucket ( buckOne , buckTwo , goal , starterBuck )
34
34
expect ( twoBucket . moves ( ) ) . toEqual ( 14 )
35
35
expect ( twoBucket . goalBucket ) . toEqual ( 'one' )
36
36
expect ( twoBucket . otherBucket ) . toEqual ( 11 )
37
37
} )
38
38
39
39
xtest ( 'starting with bucket two' , ( ) => {
40
- const starterBuck = 'two'
40
+ const starterBuck = Bucket . Two
41
41
const twoBucket = new TwoBucket ( buckOne , buckTwo , goal , starterBuck )
42
42
expect ( twoBucket . moves ( ) ) . toEqual ( 18 )
43
43
expect ( twoBucket . goalBucket ) . toEqual ( 'two' )
0 commit comments