1
exercism fetch javascript prime-factors

prime-factors.spec.js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
var primeFactors = require('./prime-factors');

describe('primeFactors', function () {
  it('returns an empty array for 1', function () {
    expect(primeFactors.for(1)).toEqual([]);
  });

  xit('factors 2', function () {
    expect(primeFactors.for(2)).toEqual([2]);
  });

  xit('factors 3', function () {
    expect(primeFactors.for(3)).toEqual([3]);
  });

  xit('factors 4', function () {
    expect(primeFactors.for(4)).toEqual([2, 2]);
  });

  xit('factors 6', function () {
    expect(primeFactors.for(6)).toEqual([2, 3]);
  });

  xit('factors 8', function () {
    expect(primeFactors.for(8)).toEqual([2, 2, 2]);
  });

  xit('factors 9', function () {
    expect(primeFactors.for(9)).toEqual([3, 3]);
  });

  xit('factors 27', function () {
    expect(primeFactors.for(27)).toEqual([3, 3, 3]);
  });

  xit('factors 625', function () {
    expect(primeFactors.for(625)).toEqual([5, 5, 5, 5]);
  });

  xit('factors 901255', function () {
    expect(primeFactors.for(901255)).toEqual([5, 17, 23, 461]);
  });

  xit('factors 93819012551', function () {
    expect(primeFactors.for(93819012551)).toEqual([11, 9539, 894119]);
  });
});