Sha256: 87b0667b0977cb00ec491a3c69e225becaa9f69289db0b6ec7167dec55b575bf
Contents?: true
Size: 1.7 KB
Versions: 110
Compression:
Stored size: 1.7 KB
Contents
import {TwoBucket, Bucket} from './two-bucket' describe('TwoBucket', () => { describe('works for input of 3, 5, 1', () => { const buckOne = 3 const buckTwo = 5 const goal = 1 test('starting with bucket one', () => { const starterBuck = Bucket.One // indicates which bucket to fill first const 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 }) xtest('starting with bucket two', () => { const starterBuck = Bucket.Two const 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', () => { const buckOne = 7 const buckTwo = 11 const goal = 2 xtest('starting with bucket one', () => { const starterBuck = Bucket.One const twoBucket = new TwoBucket(buckOne, buckTwo, goal, starterBuck) expect(twoBucket.moves()).toEqual(14) expect(twoBucket.goalBucket).toEqual('one') expect(twoBucket.otherBucket).toEqual(11) }) xtest('starting with bucket two', () => { const starterBuck = Bucket.Two const twoBucket = new TwoBucket(buckOne, buckTwo, goal, starterBuck) expect(twoBucket.moves()).toEqual(18) expect(twoBucket.goalBucket).toEqual('two') expect(twoBucket.otherBucket).toEqual(7) }) }) })
Version data entries
110 entries across 110 versions & 1 rubygems