-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest-spec.js
83 lines (82 loc) · 1.25 KB
/
test-spec.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
let obj = {
uid: '17eb608274195f86',
operationUID: '17d91ba60343c224',
contractUID: undefined,
reference: undefined,
account: '17fa5dad0bce9729',
ledger: '3812',
asset: '172b3949422a5d2b',
value: 0.11,
side: 'Debit',
date: {
createdAt: 1587393079438,
recordingDate: 1587393078104,
valueDate: 1587393078104,
effectiveDate: 1587393078104
},
classification: {
contractType: 'Loan',
contractSubype: 'Disburse',
contractMethod: '+',
operationType: 'Fee_Transaction',
operationSubtype: 'Processing',
operationMethod: 'Book'
},
message: undefined,
source: undefined,
end: undefined,
origin: undefined,
timestamp: 1587393079592
}
let spec = {
uid: {
required: true
},
operationUID: {
required: true
},
contractUID: {
required: true
},
reference: {
required: false
},
account: {
required: true
},
ledger: {
required: false
},
asset: {
required: true
},
value: {
required: true
},
side: {
required: true
},
date: {
required: true
},
classification: {
required: true
},
message: {
required: false
},
source: {
required: false
},
end: {
required: false
},
origin: {
required: false
},
timestamp: {
required: true
}
}
var f = require('./vindication')
console.log( f.validate( obj, spec ) )