Sha256: 1c2b4c6d3dd1b345a042c03882c1568ef555d4fb68970e691f8e22555e77f62e

Contents?: true

Size: 811 Bytes

Versions: 208

Compression:

Stored size: 811 Bytes

Contents

import Triangle from './pascals-triangle';

describe('Triangle', () => {

  it('with one row', () => {
    expect(new Triangle(1).rows).toEqual([[ 1 ]]);
  });

  xit('with two rows', () => {
    expect(new Triangle(2).rows).toEqual([ [ 1 ], [ 1, 1 ] ]);
  });

  xit('with three rows', () => {
    expect(new Triangle(3).rows).toEqual([ [ 1 ], [ 1, 1 ], [ 1, 2, 1 ] ]);
  });

  xit('last row', () => {
    expect(new Triangle(4).lastRow).toEqual([ 1, 3, 3, 1 ]);
  });

  xit('fifth row', () => {
    expect(new Triangle(5).lastRow).toEqual([ 1, 4, 6, 4, 1 ]);
  });

  xit('twentieth row', () => {
    const twentieth = [ 1, 19, 171, 969, 3876, 11628, 27132, 50388, 75582, 92378, 92378, 75582, 50388, 27132, 11628, 3876, 969, 171, 19, 1 ];
    expect(new Triangle(20).lastRow).toEqual(twentieth);
  });

});

Version data entries

208 entries across 208 versions & 1 rubygems

Version Path
trackler-2.1.0.53 tracks/ecmascript/exercises/pascals-triangle/pascals-triangle.spec.js
trackler-2.1.0.52 tracks/ecmascript/exercises/pascals-triangle/pascals-triangle.spec.js
trackler-2.1.0.51 tracks/ecmascript/exercises/pascals-triangle/pascals-triangle.spec.js
trackler-2.1.0.50 tracks/ecmascript/exercises/pascals-triangle/pascals-triangle.spec.js
trackler-2.1.0.49 tracks/ecmascript/exercises/pascals-triangle/pascals-triangle.spec.js
trackler-2.1.0.48 tracks/ecmascript/exercises/pascals-triangle/pascals-triangle.spec.js
trackler-2.1.0.47 tracks/ecmascript/exercises/pascals-triangle/pascals-triangle.spec.js
trackler-2.1.0.46 tracks/ecmascript/exercises/pascals-triangle/pascals-triangle.spec.js
trackler-2.1.0.45 tracks/ecmascript/exercises/pascals-triangle/pascals-triangle.spec.js
trackler-2.1.0.44 tracks/ecmascript/exercises/pascals-triangle/pascals-triangle.spec.js
trackler-2.1.0.43 tracks/ecmascript/exercises/pascals-triangle/pascals-triangle.spec.js
trackler-2.1.0.42 tracks/ecmascript/exercises/pascals-triangle/pascals-triangle.spec.js
trackler-2.1.0.41 tracks/ecmascript/exercises/pascals-triangle/pascals-triangle.spec.js
trackler-2.1.0.40 tracks/ecmascript/exercises/pascals-triangle/pascals-triangle.spec.js
trackler-2.1.0.39 tracks/ecmascript/exercises/pascals-triangle/pascals-triangle.spec.js
trackler-2.1.0.38 tracks/ecmascript/exercises/pascals-triangle/pascals-triangle.spec.js
trackler-2.1.0.37 tracks/ecmascript/exercises/pascals-triangle/pascals-triangle.spec.js
trackler-2.1.0.36 tracks/ecmascript/exercises/pascals-triangle/pascals-triangle.spec.js
trackler-2.1.0.34 tracks/ecmascript/exercises/pascals-triangle/pascals-triangle.spec.js
trackler-2.1.0.33 tracks/ecmascript/exercises/pascals-triangle/pascals-triangle.spec.js