Sha256: d02ad4075fb917edf81890d17f1c53e822e206dc1adb6f5fbf8ec81c9587b5d4

Contents?: true

Size: 1.7 KB

Versions: 185

Compression:

Stored size: 1.7 KB

Contents

import TwoBucket 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 = '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 = '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 = '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 = '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

185 entries across 185 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/ecmascript/exercises/two-bucket/two-bucket.spec.js
trackler-2.2.1.179 tracks/ecmascript/exercises/two-bucket/two-bucket.spec.js
trackler-2.2.1.178 tracks/ecmascript/exercises/two-bucket/two-bucket.spec.js
trackler-2.2.1.177 tracks/ecmascript/exercises/two-bucket/two-bucket.spec.js
trackler-2.2.1.176 tracks/ecmascript/exercises/two-bucket/two-bucket.spec.js
trackler-2.2.1.175 tracks/ecmascript/exercises/two-bucket/two-bucket.spec.js
trackler-2.2.1.174 tracks/ecmascript/exercises/two-bucket/two-bucket.spec.js
trackler-2.2.1.173 tracks/ecmascript/exercises/two-bucket/two-bucket.spec.js
trackler-2.2.1.172 tracks/ecmascript/exercises/two-bucket/two-bucket.spec.js
trackler-2.2.1.171 tracks/ecmascript/exercises/two-bucket/two-bucket.spec.js
trackler-2.2.1.170 tracks/ecmascript/exercises/two-bucket/two-bucket.spec.js
trackler-2.2.1.169 tracks/ecmascript/exercises/two-bucket/two-bucket.spec.js
trackler-2.2.1.167 tracks/ecmascript/exercises/two-bucket/two-bucket.spec.js
trackler-2.2.1.166 tracks/ecmascript/exercises/two-bucket/two-bucket.spec.js
trackler-2.2.1.165 tracks/ecmascript/exercises/two-bucket/two-bucket.spec.js
trackler-2.2.1.164 tracks/ecmascript/exercises/two-bucket/two-bucket.spec.js
trackler-2.2.1.163 tracks/ecmascript/exercises/two-bucket/two-bucket.spec.js
trackler-2.2.1.162 tracks/ecmascript/exercises/two-bucket/two-bucket.spec.js
trackler-2.2.1.161 tracks/ecmascript/exercises/two-bucket/two-bucket.spec.js
trackler-2.2.1.160 tracks/ecmascript/exercises/two-bucket/two-bucket.spec.js