1
exercism fetch ecmascript 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
import Diamond from './diamond.js';

describe('Make diamond function', () => {
  const diamond = new Diamond();

  test('test letter A', () => {
    const result = 'A\n';
    expect(diamond.makeDiamond('A')).toEqual(result);
  });

  xtest('test letter C', () => {
    const result = `${['  A  ',
      ' B B ',
      'C   C',
      ' B B ',
      '  A  '].join('\n')}\n`;
    expect(diamond.makeDiamond('C')).toEqual(result);
  });

  xtest('test letter E', () => {
    const 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);
  });
});