-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rate.test.coffee
77 lines (74 loc) · 3.11 KB
/
Rate.test.coffee
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import React from 'react'
import { shallow } from 'enzyme'
import Rate from './Rate.cjsx'
full = 'FaStar'
half = 'FaStarHalfEmpty'
empty = 'FaStarO'
describe 'Rate', ->
describe 'si se le pasa una puntuación de', ->
describe '5', ->
it 'se muestran 5 estrellas llenas', ->
wrapper = shallow <Rate value={5} />
expect(wrapper.find full) .toHaveLength 5
expect(wrapper.find half).toHaveLength 0
expect(wrapper.find empty).toHaveLength 0
describe '4.8', ->
it 'se muestran 5 estrellas llenas', ->
wrapper = shallow <Rate value={4.8} />
expect(wrapper.find full).toHaveLength 5
expect(wrapper.find half).toHaveLength 0
expect(wrapper.find empty).toHaveLength 0
describe '4.7', ->
it 'se muestran 4 estrellas y media', ->
wrapper = shallow <Rate value={4.7} />
expect(wrapper.find full).toHaveLength 4
expect(wrapper.find half).toHaveLength 1
expect(wrapper.find empty).toHaveLength 0
describe '4.3', ->
it 'se muestran 4 estrellas y media', ->
wrapper = shallow <Rate value={4.3} />
expect(wrapper.find full).toHaveLength 4
expect(wrapper.find half).toHaveLength 1
expect(wrapper.find empty).toHaveLength 0
describe '4.1', ->
it 'se muestran 4 estrellas y una vacía', ->
wrapper = shallow(<Rate value={4.1} />)
expect(wrapper.find full).toHaveLength 4
expect(wrapper.find half).toHaveLength 0
expect(wrapper.find empty).toHaveLength 1
describe '4', ->
it 'se muestran 4 estrellas y una vacía', ->
wrapper = shallow <Rate value={4} />
expect(wrapper.find full).toHaveLength 4
expect(wrapper.find half).toHaveLength 0
expect(wrapper.find empty).toHaveLength 1
describe '3.9', ->
it 'se muestran 4 estrellas y una vacía', ->
wrapper = shallow <Rate value={3.9} />
expect(wrapper.find full).toHaveLength 4
expect(wrapper.find half).toHaveLength 0
expect(wrapper.find empty).toHaveLength 1
describe '3.6', ->
it 'se muestran 3 estrellas, una media y una vacía', ->
wrapper = shallow <Rate value={3.6} />
expect(wrapper.find full).toHaveLength 3
expect(wrapper.find half).toHaveLength 1
expect(wrapper.find empty).toHaveLength 1
describe '3.1', ->
it 'se muestran 3 estrellas, y dos vacías', ->
wrapper = shallow <Rate value={3.1} />
expect(wrapper.find full).toHaveLength 3
expect(wrapper.find half).toHaveLength 0
expect(wrapper.find empty).toHaveLength 2
describe '1.5', ->
it 'se muestra 1 estrella, una media, y tres vacías', ->
wrapper = shallow <Rate value={1.5} />
expect(wrapper.find full).toHaveLength 1
expect(wrapper.find half).toHaveLength 1
expect(wrapper.find empty).toHaveLength 3
describe '0', ->
it 'se muestran 5 estrallas vacías', ->
wrapper = shallow <Rate value={0} />
expect(wrapper.find full).toHaveLength 0
expect(wrapper.find half).toHaveLength 0
expect(wrapper.find empty).toHaveLength 5