diff --git a/exercises/practice/two-bucket/.meta/config.json b/exercises/practice/two-bucket/.meta/config.json index 1df1acfe6a..df8d3a9cf5 100644 --- a/exercises/practice/two-bucket/.meta/config.json +++ b/exercises/practice/two-bucket/.meta/config.json @@ -5,6 +5,7 @@ "contributors": [ "ankorGH", "ganderzz", + "jagdish-15", "rchavarria", "ryanplusplus", "slaymance", diff --git a/exercises/practice/two-bucket/.meta/tests.toml b/exercises/practice/two-bucket/.meta/tests.toml index d6ff02f53e..a3fe533ece 100644 --- a/exercises/practice/two-bucket/.meta/tests.toml +++ b/exercises/practice/two-bucket/.meta/tests.toml @@ -27,6 +27,12 @@ description = "Measure one step using bucket one of size 1 and bucket two of siz [eb329c63-5540-4735-b30b-97f7f4df0f84] description = "Measure using bucket one of size 2 and bucket two of size 3 - start with bucket one and end with bucket two" +[58d70152-bf2b-46bb-ad54-be58ebe94c03] +description = "Measure using bucket one much bigger than bucket two" + +[9dbe6499-caa5-4a58-b5ce-c988d71b8981] +description = "Measure using bucket one much smaller than bucket two" + [449be72d-b10a-4f4b-a959-ca741e333b72] description = "Not possible to reach the goal" diff --git a/exercises/practice/two-bucket/two-bucket.spec.js b/exercises/practice/two-bucket/two-bucket.spec.js index f6832cb8ad..dd05397480 100644 --- a/exercises/practice/two-bucket/two-bucket.spec.js +++ b/exercises/practice/two-bucket/two-bucket.spec.js @@ -74,32 +74,35 @@ describe('TwoBucket', () => { }); }); - describe('Reachability', () => { - const buckOne = 6; - const buckTwo = 15; + xtest('Measure using bucket one much bigger than bucket two', () => { + const twoBucket = new TwoBucket(5, 1, 2, 'one'); + const result = twoBucket.solve(); + expect(result.moves).toEqual(6); + expect(result.goalBucket).toEqual('one'); + expect(result.otherBucket).toEqual(1); + }); - xtest('Not possible to reach the goal, start with bucket one', () => { - expect(() => new TwoBucket(buckOne, buckTwo, 5, 'one')).toThrow(); - }); + xtest('Measure using bucket one much smaller than bucket two', () => { + const twoBucket = new TwoBucket(3, 15, 9, 'one'); + const result = twoBucket.solve(); + expect(result.moves).toEqual(6); + expect(result.goalBucket).toEqual('two'); + expect(result.otherBucket).toEqual(0); + }); - xtest('Not possible to reach the goal, start with bucket two', () => { - expect(() => new TwoBucket(buckOne, buckTwo, 5, 'two')).toThrow(); - }); + xtest('Not possible to reach the goal', () => { + expect(() => new TwoBucket(6, 15, 5, 'one')).toThrow(); + }); - xtest('With the same buckets but a different goal, then it is possible', () => { - const starterBuck = 'one'; - const goal = 9; - const twoBucket = new TwoBucket(buckOne, buckTwo, goal, starterBuck); - const result = twoBucket.solve(); - expect(result.moves).toEqual(10); - expect(result.goalBucket).toEqual('two'); - expect(result.otherBucket).toEqual(0); - }); + xtest('With the same buckets but a different goal, then it is possible', () => { + const twoBucket = new TwoBucket(6, 15, 9, 'one'); + const result = twoBucket.solve(); + expect(result.moves).toEqual(10); + expect(result.goalBucket).toEqual('two'); + expect(result.otherBucket).toEqual(0); }); - describe('Goal larger than both buckets', () => { - xtest('Is impossible', () => { - expect(() => new TwoBucket(5, 7, 8, 'one')).toThrow(); - }); + xtest('Goal larger than both buckets is impossible', () => { + expect(() => new TwoBucket(5, 7, 8, 'one')).toThrow(); }); });