xml-toolkit 1.0.12 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/test/test.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const fs = require ('fs')
2
2
  const assert = require ('assert')
3
- const {XMLReader, SAXEvent, XMLLexer, AttributesMap, XMLNode, XMLSchemata} = require ('../')
3
+ const {XMLReader, SAXEvent, XMLLexer, AttributesMap, XMLNode, XMLSchemata, SOAP11} = require ('../')
4
4
 
5
5
  async function test_001_lexer_sync (fn) {
6
6
 
@@ -97,24 +97,10 @@ console.log (xml)
97
97
  */
98
98
  //console.log ([xml, s])
99
99
 
100
-
101
- try {
102
-
103
-
104
-
105
100
  const v = await sax.process (xml).findFirst ()
106
101
 
107
102
  console.log (JSON.stringify (v, null, 2))
108
103
 
109
-
110
- }
111
- catch (x) {
112
- console.log ({x})
113
- }
114
-
115
-
116
-
117
-
118
104
  }
119
105
 
120
106
  async function test_004_schemata (fn) {
@@ -331,46 +317,53 @@ async function test_006_schemata (fn) {
331
317
 
332
318
  }
333
319
 
334
- async function test_007_schemata (fn) {
335
-
336
- const xs = await XMLSchemata.fromFile ('test/20186.wsdl')
320
+ async function test_007_wsdl (fn) {
337
321
 
338
- const data =
339
- {"GetForm9Sync":{
340
- "person": {"LastName":"КУПРИН","FirstName":"АНДРЕЙ","SecondName":"АНДРЕЙ","BirthDate":"1967-04-10"},
341
- "address":{"Region":{"Code":"78","Name":"Санкт-Петербург"},"Street":{"Code":"5381","Name":"Вокзальная ул"},"House":"д. 9 к. 3 литера В","Flat":"50"}
342
- }}
343
-
344
- // const m = xs.createMarshaller ('AppDataChildDotation', 'http://smev.gosuslugi.ru/rev111111')
322
+ const soap = await SOAP11.fromFile ('test/20186.wsdl')
345
323
 
346
- console.log (xs.stringify (data))
324
+ console.log (soap.http ({GetForm9Sync: {address: {Region: {Code: 78}}}}))
347
325
 
348
326
  }
349
327
 
350
328
  async function test_008_schemata (fn) {
351
329
 
352
- const xs = await XMLSchemata.fromFile ('test/fns-innfdrfio-root.xsd')
353
-
354
- const IDRequest = '0000000001'
330
+ const xs = await XMLSchemata.fromFile ('test/30017.xsd')
355
331
 
356
- const PhysicalPersonINN = '520205004556'
357
-
358
- // const data = {INNFDRFIOResponse: {'IDRequest ': IDRequest, PhysicalPersonINN}}
359
- const data = {INNFDRFIORequest: {
360
- IDRequest: 1,
361
- DataPersonRequest: {
362
- BirthDate: "1992-07-28",
363
- FamilyName: "ИВАНОВ",
364
- FirstName: "МИХАИЛ",
365
- Patronymic: "АЛЕКСЕЕВИЧ",
332
+ const data =
333
+
334
+ {"FNSINNSingularRequest":
335
+ {
336
+ "СведЮЛ": {
337
+ "ОГРН":"1037843048880",
338
+ "ИННЮЛ":"7825497650",
339
+ "НаимОрг":"Нагрузочное тестирование"
340
+ },
341
+ "СведФЛ": {
342
+ "ДатаРожд":"1973-07-14",
343
+ "МестоРожд":null,
344
+ "ФИО":{
345
+ "Фамилия":"ВАЛЕРЬЕВНА",
346
+ "Имя":"1973-07-14",
347
+ "Отчество":"1973-07-14"
348
+ },
349
+ "УдЛичнФЛ":{
350
+ "КодВидДок":"21",
351
+ "ВыдДок":"11",
352
+ "КодВыдДок":"111 111",
353
+ "ДатаДок":"2022-10-01",
354
+ "СерНомДок":"11 11 111111"}
355
+ },
356
+ "ИдЗапрос":"7daf950d-d71c-ea20-eaa9-5096324ca3b3"
366
357
  }
367
358
  }
368
- }
369
-
359
+
360
+
361
+
370
362
  console.log (xs.stringify (data))
371
363
 
372
364
  }
373
365
 
366
+
374
367
  async function main () {
375
368
 
376
369
  // await test_001_lexer_sync ('E05a.xml')
@@ -385,10 +378,10 @@ async function main () {
385
378
  // await test_003_emitter_sync ('not-sa01.xml')
386
379
  // await test_003_emitter_sync ('ent.xml')
387
380
  // await test_003_emitter_sync ('soap.xml')
388
- await test_004_schemata ()
389
- await test_005_schemata ()
381
+ // await test_004_schemata ()
382
+ // await test_005_schemata ()
390
383
  await test_006_schemata ()
391
- await test_007_schemata ()
384
+ // await test_007_wsdl ()
392
385
  await test_008_schemata ()
393
386
 
394
387
  }