-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
122 lines (117 loc) · 2.8 KB
/
test.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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import test from 'ava'
import senadoresDetalle from './'
test('senadores-detalle fails when no senator', t => {
return senadoresDetalle(112233)
.then(() => t.fail())
.catch(() => t.pass())
})
test('senadores-detalle works', async t => {
t.plan(6)
const detalleAllende = await senadoresDetalle('Allende')
const detalleAllamand = await senadoresDetalle('Allamand')
t.true(detalleAllende[0].hasOwnProperty('representacion'))
t.true(detalleAllende[0].hasOwnProperty('enlaces'))
t.true(detalleAllamand[0].hasOwnProperty('representacion'))
t.true(detalleAllamand[0].hasOwnProperty('enlaces'))
t.deepEqual(detalleAllende[0], {
'id': 985,
'nombre': 'Allende Bussi, Isabel',
'rut': '4465782-1',
'region': 'Región de Atacama',
'circunscripcion': 3,
'telefono': '(56-32) 2504671',
'mail': 'iallende@senado.cl',
'partido': 'P.S.',
'representacion': {
'superficie': {
'cantidad': 75176,
'medida': 'Km2'
},
'habitantes': 254336,
'circunscripcion': '3 (Atacama)',
'distritos': [
5,
6
],
'comunas': [
'Chañaral',
'Copiapó',
'Diego de Almagro',
'Alto del Carmen',
'Caldera',
'Huasco',
'Freirina',
'Tierra Amarilla',
'Vallenar'
]
},
'enlaces': [
'http://twitter.com/iallendebussi',
'http://www.facebook.com/senadoraisabelallende',
'http://www.flickr.com/photos/isabelallendebussi',
'http://www.isabelallendebussi.cl/'
]
})
t.deepEqual(detalleAllamand[0], {
'id': 905,
'nombre': 'Allamand Zavala, Andrés',
'rut': '5002921-2',
'region': 'Región Metropolitana ',
'circunscripcion': 7,
'telefono': '(56-32) 2504701',
'mail': 'allamand@senado.cl',
'partido': 'R.N.',
'representacion': {
'superficie': {
'cantidad': 8423,
'medida': 'Km2'
},
'habitantes': 2974692,
'circunscripcion': '7 (Santiago Poniente)',
'distritos': [
16,
17,
18,
19,
20,
22,
30,
31
],
'comunas': [
'Colina',
'Lampa',
'Quilicura',
'Pudahuel',
'Tiltil',
'Conchalí',
'Huechuraba',
'Renca',
'Quinta Normal',
'Lo Prado',
'Cerro Navia',
'Independencia',
'Recoleta',
'Cerrillos',
'Estación Central',
'Maipú',
'Santiago',
'Buin',
'Calera de Tango',
'Paine',
'San Bernardo',
'Alhué',
'Curacaví',
'El Monte',
'Isla de Maipo',
'María Pinto',
'Melipilla',
'Padre Hurtado',
'Peñaflor',
'San Pedro',
'Talagante'
]
},
'enlaces': []
})
})