getPrimeFactorsSpec.js 484 Bytes
/*global describe it*/
import assert from 'assert';
import getPrimeFactors from '../src/getPrimeFactors.js';

const cases = [{
  number:91,
  factors:[7,13]
},{
  number:127381,
  factors:[17,59,127]
},{
  number:65536,
  factors:[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2]
}];



describe('getPrimeFactors()', function () {
  cases.forEach(function (c) {
    it('finds prime factors of ' + c.number, function () {
      assert.deepEqual(getPrimeFactors(c.number), c.factors);
    });
  });
});