-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from gustavochavarria/feature/get-municipalitie…
…s-from-dni Feature/get municipalities from dni
- Loading branch information
Showing
10 changed files
with
1,292 additions
and
1,353 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
name: CI | ||
|
||
on: [push] | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
tests: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"singleQuote": true, | ||
"bracketSpacing": false, | ||
"bracketSpacing": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
import test from 'ava'; | ||
|
||
import dnic, {dnicWithDateValidation} from '../src'; | ||
import dnic, {validate, validateDate} from '../src'; | ||
|
||
const VALID_DNI = '001-280592-0025N'; | ||
const INVALID_DATE = '001-310292-0000N'; | ||
|
||
test('shoud pass a valid dni', t => { | ||
t.true(dnic(VALID_DNI)); | ||
test('should pass a valid dni (default)', t => { | ||
t.true(dnic.isValid(VALID_DNI)); | ||
}); | ||
|
||
test('validate date', t => { | ||
t.true(dnicWithDateValidation(VALID_DNI)); | ||
t.false(dnicWithDateValidation(INVALID_DATE)); | ||
test('should pass a valid dni', t => { | ||
t.true(validate(VALID_DNI)); | ||
}); | ||
|
||
test('valid dni (date)', t => { | ||
t.true(validateDate(VALID_DNI)); | ||
}); | ||
|
||
test('valid a wrong date', t => { | ||
t.false(validateDate(INVALID_DATE)); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,222 @@ | ||
const atlanticoNorte = [ | ||
{'607': 'Puerto Cabezas'}, | ||
{'608': 'Waspán'}, | ||
{'610': 'Siuna'}, | ||
{'611': 'Bonanza'}, | ||
{'612': 'Rosita'}, | ||
{'615': 'Bocana Paiwás'}, | ||
{'454': 'Waslala'}, | ||
{'602': 'Corn Island'} | ||
]; | ||
|
||
const atlanticoSur = [ | ||
{'601': 'Bluefields'}, | ||
{'603': 'El Rama'}, | ||
{'604': 'Muelle De Los Buelles'}, | ||
{'605': 'La Cruz De Rio Grande'}, | ||
{'606': 'Prinzapolka'}, | ||
{'616': 'Nueva Guinea'}, | ||
{'619': 'Tortuguero'}, | ||
{'624': 'Kukra Hill'}, | ||
{'626': 'Laguna De Perlas'}, | ||
{'627': 'Desembocadura Rio Grande'}, | ||
{'628': 'El Ayote'} | ||
]; | ||
|
||
const boaco = [ | ||
{'361': 'Boaco'}, | ||
{'362': 'Camoapa'}, | ||
{'363': 'Santa Lucía'}, | ||
{'364': 'San José Del Remate'}, | ||
{'365': 'San Lorenzo'}, | ||
{'366': 'Teustepe'} | ||
]; | ||
|
||
const carazo = [ | ||
{'041': 'Jinotepe'}, | ||
{'042': 'Diriamba'}, | ||
{'043': 'San Marcos'}, | ||
{'044': 'Santa Teresa'}, | ||
{'045': 'Dolores'}, | ||
{'046': 'La Paz Carazo'}, | ||
{'047': 'El Rosario'}, | ||
{'048': 'La Conquista'} | ||
]; | ||
|
||
const chinandega = [ | ||
{'081': 'Chinandega'}, | ||
{'082': 'Corinto'}, | ||
{'083': 'El Realejo'}, | ||
{'084': 'Chichigalpa'}, | ||
{'085': 'Posoltega'}, | ||
{'086': 'El Viejo'}, | ||
{'087': 'Puerto Morazán'}, | ||
{'088': 'Somotillo'}, | ||
{'089': 'Villa Nueva'}, | ||
{'090': 'Santo Tomás del Norte'}, | ||
{'091': 'Cinco Pinos'}, | ||
{'092': 'San Francisco Del Norte'}, | ||
{'093': 'San Pedro Del Norte'} | ||
]; | ||
|
||
const chontales = [ | ||
{'121': 'Juigalpa'}, | ||
{'122': 'Acoyapa'}, | ||
{'123': 'Santo Tomás'}, | ||
{'124': 'Villa Sandino'}, | ||
{'125': 'San Pedro de Lóvago'}, | ||
{'126': 'La Libertad'}, | ||
{'127': 'Santo Domingo'}, | ||
{'128': 'Comalapa'}, | ||
{'129': 'San Francisco Cuapa'}, | ||
{'130': 'El Coral'} | ||
]; | ||
|
||
const esteli = [ | ||
{'161': 'Estelí'}, | ||
{'162': 'Pueblo Nuevo'}, | ||
{'163': 'Condega'}, | ||
{'164': 'San Juan Limay'}, | ||
{'165': 'La Trinidad'}, | ||
{'166': 'San Nicolás'} | ||
]; | ||
|
||
const granada = [ | ||
{'201': 'Granada'}, | ||
{'202': 'Nandaime'}, | ||
{'203': 'Diriomo'}, | ||
{'204': 'Diriá'} | ||
]; | ||
|
||
const jinotega = [ | ||
{'241': 'Jinotega'}, | ||
{'242': 'San Rafael Del Norte'}, | ||
{'243': 'San Sebastián Yalí'}, | ||
{'244': 'La Concordia'}, | ||
{'245': 'San José De Bocay'}, | ||
{'246': 'El Cuá Bocay'}, | ||
{'247': 'Santa María Pantasma'} | ||
]; | ||
|
||
const leon = [ | ||
{'281': 'Leon'}, | ||
{'283': 'El Jicaral'}, | ||
{'284': 'La Paz Centro'}, | ||
{'285': 'Santa Rosa Del Peñón'}, | ||
{'286': 'Quetzalguaque'}, | ||
{'287': 'Nagarote'}, | ||
{'288': 'El Sauce'}, | ||
{'289': 'Achuapa'}, | ||
{'290': 'Telica'}, | ||
{'291': 'Larreynaga Malpaisillo'} | ||
]; | ||
|
||
const madriz = [ | ||
{'321': 'Somoto'}, | ||
{'322': 'Telpaneca'}, | ||
{'323': 'Sn Juan Rio Coco'}, | ||
{'324': 'Palacagüina'}, | ||
{'325': 'Yalagüina'}, | ||
{'326': 'Totogalpa'}, | ||
{'327': 'San Lucas'}, | ||
{'328': 'La Sabanas'}, | ||
{'329': 'San José De Cusmapa'} | ||
]; | ||
|
||
const managua = [ | ||
{'001': 'Managua'}, | ||
{'002': 'San Rafael Del Sur'}, | ||
{'003': 'Tipitapa'}, | ||
{'004': 'Villa Carlos Fonseca'}, | ||
{'005': 'San Francisco Libre'}, | ||
{'006': 'Mateare'} | ||
{'006': 'Mateare'}, | ||
{'007': 'Ticuantepe'}, | ||
{'008': 'Ciudad Sandino'}, | ||
{'009': 'El Crucero'} | ||
]; | ||
|
||
const leon = [{'281': 'Leon'}]; | ||
const masaya = [ | ||
{'401': 'Masaya'}, | ||
{'402': 'Nindirí'}, | ||
{'403': 'Tisma'}, | ||
{'404': 'Catarina'}, | ||
{'405': 'San Juan Oriente'}, | ||
{'406': 'Niquinohomo'}, | ||
{'407': 'Nandasmo'}, | ||
{'408': 'Masatepe'}, | ||
{'409': 'La Concepción'} | ||
]; | ||
|
||
const chinandega = [ | ||
{'081': 'Chinandega'}, | ||
{'082': 'Corinto'}, | ||
{'083': 'El Realejo'} | ||
const matagalpa = [ | ||
{'441': 'Matagalpa'}, | ||
{'442': 'San Ramón'}, | ||
{'443': 'Matiguás'}, | ||
{'444': 'Muy Muy'}, | ||
{'445': 'Esquipulas'}, | ||
{'446': 'San Dionisio'}, | ||
{'447': 'San Isidro'}, | ||
{'448': 'Sébaco'}, | ||
{'449': 'Ciudad Darío'}, | ||
{'450': 'Terrabona'}, | ||
{'451': 'Rio Blanco'}, | ||
{'452': 'Tuma La Dalia'}, | ||
{'453': 'Rancho Grande'} | ||
]; | ||
|
||
export const municipalities = [...managua, ...leon, ...chinandega]; | ||
const nuevaSegovia = [ | ||
{'481': 'Ocotal'}, | ||
{'482': 'Santa María'}, | ||
{'483': 'Macuelizo'}, | ||
{'484': 'Dipilto'}, | ||
{'485': 'Ciudad Antigua'}, | ||
{'486': 'Mozonte'}, | ||
{'487': 'San Fernando'}, | ||
{'488': 'El Jícaro'}, | ||
{'489': 'Jalapa'}, | ||
{'490': 'Murra'}, | ||
{'491': 'Quilalí'}, | ||
{'492': 'Wiwilí'}, | ||
{'493': 'Wiwilí Nueva Segovia'} | ||
]; | ||
|
||
const rioSanJuan = [ | ||
{'521': 'San Carlos'}, | ||
{'522': 'El Castillo'}, | ||
{'523': 'San Miguelito'}, | ||
{'524': 'Morrito'}, | ||
{'525': 'San Juan del Norte'}, | ||
{'526': 'El Almendro'} | ||
]; | ||
|
||
const rivas = [ | ||
{'561': 'Rivas'}, | ||
{'562': 'San Jorge'}, | ||
{'563': 'Buenos Aires'}, | ||
{'564': 'Potosí'}, | ||
{'565': 'Belén'}, | ||
{'566': 'Tola'}, | ||
{'567': 'San Juan Sur'}, | ||
{'568': 'Cárdenas'}, | ||
{'569': 'Moyogalpa'}, | ||
{'570': 'Altagracia'} | ||
]; | ||
|
||
export const municipalities = [ | ||
...atlanticoNorte, | ||
...atlanticoSur, | ||
...boaco, | ||
...carazo, | ||
...chinandega, | ||
...chontales, | ||
...granada, | ||
...jinotega, | ||
...leon, | ||
...madriz, | ||
...managua, | ||
...masaya, | ||
...matagalpa, | ||
...nuevaSegovia, | ||
...rioSanJuan, | ||
...rivas, | ||
...esteli | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.