Skip to content

Commit

Permalink
test municipalities
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavochavarria committed Nov 26, 2019
1 parent 2f3cd19 commit 1194193
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,12 @@ Esctructura del DNI:

## Uso

import dnic from '@nerdify/dnic'
import dnic, {validate, validateDate, getMunicipalities} from '@nerdify/dnic'

const dni = '281-140891-0022V';

dnic.isValid(dni); // true

validate(dni); // true

getMunicipalities(dni); // Leon
6 changes: 5 additions & 1 deletion __tests__/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import test from 'ava';

import dnic, {validate, validateDate} from '../src';
import dnic, {validate, validateDate, getMunicipalities} from '../src';

const VALID_DNI = '001-280592-0025N';
const INVALID_DATE = '001-310292-0000N';
Expand All @@ -20,3 +20,7 @@ test('valid dni (date)', t => {
test('valid a wrong date', t => {
t.false(validateDate(INVALID_DATE));
});

test('valid municipalities (managua)', t => {
t.is(getMunicipalities(VALID_DNI), 'Managua');
});

0 comments on commit 1194193

Please sign in to comment.