1
exercism fetch typescript diamond

diamond.test.ts

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
import Diamond from './diamond'

/* tslint:disable no-trailing-whitespace*/
describe('Make diamond function', () => {
  const diamond = new Diamond()

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

  test('test letter C', () => {
    const result = `  A  
 B B 
C   C
 B B 
  A  
`
    expect(diamond.makeDiamond('C')).toEqual(result)
  })

  test('test letter E', () => {
    const result = `    A    
   B B   
  C   C  
 D     D 
E       E
 D     D 
  C   C  
   B B   
    A    
`
    expect(diamond.makeDiamond('E')).toEqual(result)
  })
})