-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
101 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { validJMBG } from '.'; | ||
|
||
test('Valid JMBG', () => { | ||
expect(validJMBG('1703990715178')).toEqual(true); | ||
expect(validJMBG(1703990715178)).toEqual(true); | ||
}); | ||
|
||
test('Invalid JMBG', () => { | ||
expect(validJMBG('1703990715170')).toEqual(false); | ||
expect(validJMBG('1703000715170')).toEqual(false); | ||
expect(validJMBG(1703990715170)).toEqual(false); | ||
}); | ||
|
||
test('Invalid day in JMBG', () => { | ||
expect(validJMBG('8803990715178')).toEqual(false); | ||
expect(validJMBG(8803990715178)).toEqual(false); | ||
}); | ||
|
||
test('Invalid month in JMBG', () => { | ||
expect(validJMBG('1217990715178')).toEqual(false); | ||
expect(validJMBG(1217990715178)).toEqual(false); | ||
}); | ||
|
||
test('Foreign person JMBG', () => { | ||
expect(validJMBG('1703990605178')).toEqual(true); | ||
expect(validJMBG('1703990665178')).toEqual(true); | ||
expect(validJMBG(1703990605178)).toEqual(true); | ||
expect(validJMBG(1703990665178)).toEqual(true); | ||
}); | ||
|
||
test('Long JMBG', () => { | ||
expect(validJMBG('1703990715178000')).toEqual(false); | ||
expect(validJMBG(1703990715178000)).toEqual(false); | ||
}); | ||
|
||
test('short JMBG', () => { | ||
expect(validJMBG('1703990715')).toEqual(false); | ||
expect(validJMBG(1703990715)).toEqual(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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { validMB } from '.'; | ||
|
||
test('Valid MB', () => { | ||
expect(validMB('66143627')).toEqual(true); | ||
expect(validMB(66143627)).toEqual(true); | ||
}); | ||
|
||
test('Invalid MB', () => { | ||
expect(validMB('66143628')).toEqual(false); | ||
expect(validMB(66143628)).toEqual(false); | ||
}); | ||
|
||
test('Short MB', () => { | ||
expect(validMB('6614362')).toEqual(false); | ||
expect(validMB(6614362)).toEqual(false); | ||
}); | ||
|
||
test('Long MB', () => { | ||
expect(validMB('661436200')).toEqual(false); | ||
expect(validMB(661436200)).toEqual(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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { validPIB } from '.'; | ||
|
||
test('Valid PIB', () => { | ||
expect(validPIB('112497859')).toEqual(true); | ||
expect(validPIB(112497859)).toEqual(true); | ||
}); | ||
|
||
test('Invalid PIB', () => { | ||
expect(validPIB('112497851')).toEqual(false); | ||
expect(validPIB(112497851)).toEqual(false); | ||
expect(validPIB(100000000)).toEqual(false); | ||
}); | ||
|
||
test('Short PIB', () => { | ||
expect(validPIB('11249785')).toEqual(false); | ||
expect(validPIB(11249785)).toEqual(false); | ||
}); | ||
|
||
test('Long PIB', () => { | ||
expect(validPIB('11249785900')).toEqual(false); | ||
expect(validPIB(11249785900)).toEqual(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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { mod11 } from './utils'; | ||
|
||
test('Mod 11 => 0', () => { | ||
expect(mod11('111114')).toEqual(0); | ||
}); | ||
|
||
test('Mod 11 => 1', () => { | ||
expect(mod11('111123')).toEqual(null); | ||
}); | ||
|
||
test('Mod 11 => anything else', () => { | ||
expect(mod11('111118')).not.toEqual(null); | ||
expect(mod11('111118')).not.toEqual(0); | ||
}); |