File size: 1,432 Bytes
7f88cfb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
48
49
50
51
52
import React from 'react'
import chai, {expect} from 'chai'
import chaiEnzyme from 'chai-enzyme'
import {render} from 'enzyme'
import {default as Compare} from '../src/compare'

chai.use(chaiEnzyme())

describe('<Compare />', () => {

  describe('when a value is passed through to be compared for the first time', () => {

    it('should return a dash to denote that the value is not lower or higher', () => {
      const compare = render(<Compare value={1} />)

      expect(compare).to.contain.text('-')
    })

  })

  describe('when a larger value is passed through to be compared against a previous value', () => {

    it('should display an arrow upwards to denote that the value is higer', () => {
      const compare = render(<Compare value={3} />)

      expect(compare).to.contain.text('arrow_upward')
    })

  })

  describe('when a smaller value is passed through to be compared against a previous value', () => {

    it('should display an arrow downwards to denote that the value is lower', () => {
      const compare = render(<Compare value={2} />)

      expect(compare).to.contain.text('arrow_downward')
    })

  })

  describe('when the same value is passed through to be compared against a previous value', () => {

    it('should display a dash to denote that the value hasn\'t changed', () => {
      const compare = render(<Compare value={2} />)

      expect(compare).to.contain.text('-')
    })

  })

})