File tree 3 files changed +18
-3
lines changed
3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change
1
+ const { isOKPO10, randomOKPO10} = require ( '..' )
2
+
3
+ test ( 'basic' , ( ) => {
4
+
5
+ expect ( ( ) => isOKPO8 ( '1194265277' ) ) . toThrow ( )
6
+ expect ( ( ) => isOKPO8 ( '194265277' ) ) . toThrow ( )
7
+
8
+ expect ( isOKPO10 ( '0194265277' ) ) . toBeUndefined ( )
9
+
10
+ expect ( isOKPO10 ( randomOKPO10 ( ) ) ) . toBeUndefined ( )
11
+
12
+ } )
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ const Check = require ('./lib/Check')
2
2
const { OGRN_13 , OGRN_15 } = require ( './lib/Horner' )
3
3
const { INN_10 , INN_12_2 , INN_12_1 } = require ( './lib/INN' )
4
4
const SNILS = require ( './lib/SNILS' )
5
- const { OKPO_8 } = require ( './lib/OKPO' )
5
+ const { OKPO_8 , OKPO_10 } = require ( './lib/OKPO' )
6
6
class KPP extends Check { constructor ( ) { super ( 9 ) } }
7
7
8
8
module . exports = {
@@ -25,6 +25,9 @@ module.exports = {
25
25
isOKPO8 : str => new OKPO_8 ( ) . verify ( str ) ,
26
26
randomOKPO8 : ( ) => new OKPO_8 ( ) . random ( ) ,
27
27
28
+ isOKPO10 : str => new OKPO_10 ( ) . verify ( str ) ,
29
+ randomOKPO10 : ( ) => new OKPO_10 ( ) . random ( ) ,
30
+
28
31
isINN12 : str => {
29
32
new INN_12_1 ( ) . verify ( str . slice ( 0 , 11 ) )
30
33
new INN_12_2 ( ) . verify ( str )
Original file line number Diff line number Diff line change @@ -24,11 +24,11 @@ class OKPO extends ScalarProduct {
24
24
25
25
}
26
26
27
-
28
27
const okpo = valueLength => class extends OKPO { constructor ( ) { super ( valueLength ) } }
29
28
30
29
module . exports = {
31
30
32
- OKPO_8 : okpo ( 7 ) ,
31
+ OKPO_8 : okpo ( 7 ) ,
32
+ OKPO_10 : okpo ( 9 ) ,
33
33
34
34
}
You can’t perform that action at this time.
0 commit comments