1
exercism fetch javascript diamond

diamond.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
var Diamond = require('./diamond');

describe('Diamond', function () {
  var diamond = new Diamond();

  it('test letter A', function () {
    var result = 'A\n';
    expect(diamond.makeDiamond('A')).toEqual(result);
  });

  it('test letter C', function () {
    var result = ['  A  ',
      ' B B ',
      'C   C',
      ' B B ',
      '  A  '].join('\n') + '\n';
    expect(diamond.makeDiamond('C')).toEqual(result);
  });

  it('test letter E', function () {
    var result = ['    A    ',
      '   B B   ',
      '  C   C  ',
      ' D     D ',
      'E       E',
      ' D     D ',
      '  C   C  ',
      '   B B   ',
      '    A    '].join('\n') + '\n';
    expect(diamond.makeDiamond('E')).toEqual(result);
  });
});