cda-schematron-validator 1.1.2 → 1.1.6

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.
@@ -0,0 +1,45 @@
1
+ const xpath = require('xpath');
2
+ const Dom = require('@xmldom/xmldom').DOMParser;
3
+ const _get = require('lodash.get');
4
+ const checkIfFileOrPath = require('./checkIfFileOrPath');
5
+ const getSchematronMap = require('./getSchematronMap');
6
+ /**
7
+ * @method initializeProcess Checks the validity of the supplied xml and schematron, and sets some global variables used across functions in this script.
8
+ * This calls the `getSchematronMap` and assigns the value to schematronMap variable.
9
+ * @param {string} xml string content of an xml file or path to an xml file
10
+ * @param {string} schematron string content of a schematron file or path to a schematron file
11
+ * @param {object} options object that takes parameters as seen in the `validate` method
12
+ * @returns Sets the following variables with file scope
13
+ * xml, schematron, xmlDoc,
14
+ * schematronMap, namespaceMap,
15
+ * patternRuleMap, ruleAssertionMap,
16
+ * resourceDir, xmlSnippetMaxLength,
17
+ * xpathSelect, errors, warnings,
18
+ * ignored, and resultInfo
19
+ */
20
+
21
+ function initializeProcess(xml, schematron, options) {
22
+ try {
23
+ xml = checkIfFileOrPath(xml);
24
+ schematron = checkIfFileOrPath(schematron);
25
+ }
26
+ catch (err) {
27
+ return err;
28
+ }
29
+ // Load xml doc
30
+ options.xmlDoc = new Dom().parseFromString(xml);
31
+ // Allowing users to send a parsed schematron map if testing multiple xml files with the same schematron
32
+ options.schematronMap = getSchematronMap(schematron, options);
33
+ // Extract data from parsed schematron object
34
+ if (!_get(options, 'resourceDir')) {
35
+ options.resourceDir = '../';
36
+ }
37
+ if (!_get(options, 'xmlSnippetMaxLength')) {
38
+ options.xmlSnippetMaxLength = 200;
39
+ }
40
+ // Create selector object, initialized with namespaces
41
+ // Avoid using 'select' as a variable name as it is overused
42
+ options.xpathSelect = xpath.useNamespaces(options.schematronMap.namespaceMap);
43
+ }
44
+
45
+ module.exports = initializeProcess;
@@ -0,0 +1,33 @@
1
+ const _get = require('lodash.get');
2
+ const includeExternalDocument = require('./includeExternalDocument');
3
+ const testAssertion = require('./testAssertion');
4
+ const getAssertionObject = require('./getAssertionObject');
5
+ function processAssertions(assertionAndExtensionObject, selectedXml, failedAssertions, options) {
6
+ // const failedAssertions = [];
7
+ let { level, test, id, description } = assertionAndExtensionObject;
8
+ // Extract values from external document and modify test if a document call is made
9
+ const originalTest = test;
10
+ let simplifiedTest = null;
11
+ try {
12
+ test = includeExternalDocument(test, options.resourceDir);
13
+ if (originalTest !== test) {
14
+ simplifiedTest = test;
15
+ }
16
+ if (level === 'error' || _get(options, 'includeWarnings')) {
17
+ const testAssertionResponse = testAssertion(test, selectedXml, options.xpathSelect, options.xmlDoc, options.resourceDir, options.xmlSnippetMaxLength);
18
+ if ((Array.isArray(testAssertionResponse) && testAssertionResponse.length) || _get(testAssertionResponse, 'ignored')) {
19
+ const assertionObject = getAssertionObject(level, id, originalTest, simplifiedTest, description);
20
+ assertionObject.results = testAssertionResponse;
21
+ failedAssertions.push(assertionObject);
22
+ }
23
+ }
24
+ }
25
+ catch (err) {
26
+ const assertionObject = getAssertionObject(level, id, originalTest, simplifiedTest, description);
27
+ assertionObject.results = { ignored: true, errorMessage: err.message };
28
+ failedAssertions.push(assertionObject);
29
+ }
30
+ return failedAssertions;
31
+ }
32
+
33
+ module.exports = processAssertions;
@@ -0,0 +1,9 @@
1
+ const getResults = require('./getResults');
2
+ function processFailedAssertions(failedAssertions, assertionInfo, resultInfo) {
3
+ for (let index = 0; index < failedAssertions.length; index++) {
4
+ const assertionObject = failedAssertions[index];
5
+ getResults(assertionObject, assertionInfo, resultInfo);
6
+ }
7
+ }
8
+
9
+ module.exports = processFailedAssertions;
@@ -0,0 +1,20 @@
1
+ const getFailedAssertions = require('./getFailedAssertions');
2
+ const processFailedAssertions = require('./processFailedAssertions');
3
+ /**
4
+ * @method processRules Entry method to start processing schematron rules. Calls methods `getFailedAssertions` and `processFailedAssertions`
5
+ * @param {Array} rules Array of ruleIds
6
+ * @param {object} resultInfo Capturing the information of the rule to pass it on to reporting object
7
+ * @param {object} options Passing on the options object passed to the `validate` or `validateAsync` methods
8
+ */
9
+
10
+ function processRules(rules, assertionInfo, resultInfo, options) {
11
+ for (let index = 0; index < rules.length; index++) {
12
+ const ruleId = rules[index];
13
+ const failedAssertions = getFailedAssertions(ruleId, assertionInfo, options);
14
+ if (failedAssertions) {
15
+ processFailedAssertions(failedAssertions, assertionInfo, resultInfo);
16
+ }
17
+ }
18
+ }
19
+
20
+ module.exports = processRules;
@@ -0,0 +1,30 @@
1
+ const getFailedAssertions = require('./getFailedAssertions');
2
+ const processFailedAssertions = require('./processFailedAssertions');
3
+ /**
4
+ * @method processRulesAsync Entry method to start processing schematron rules. Calls methods `getFailedAssertions` and `processFailedAssertions`
5
+ * This method is same as `processRules` except that this is an Async method wrapping a promise, and returning the promise
6
+ * @param {Array} rules Array of ruleIds
7
+ * @param {object} resultInfo Capturing the information of the rule to pass it on to reporting object
8
+ * @param {object} options Passing on the options object passed to the `validate` or `validateAsync` methods
9
+ */
10
+
11
+ async function processRulesAsync(rules, assertionInfo, resultInfo, options) {
12
+ const rulesProcessed = new Promise((resolve, reject) => {
13
+ try {
14
+ for (let index = 0; index < rules.length; index++) {
15
+ const ruleId = rules[index];
16
+ const failedAssertions = getFailedAssertions(ruleId, assertionInfo, options);
17
+ resolve (failedAssertions);
18
+ if (failedAssertions) {
19
+ processFailedAssertions(failedAssertions, assertionInfo, resultInfo);
20
+ }
21
+ }
22
+ }
23
+ catch (promiseError) {
24
+ reject (new Error (`Promise Error: ${promiseError}`));
25
+ }
26
+ });
27
+ return rulesProcessed;
28
+ }
29
+
30
+ module.exports = processRulesAsync;
@@ -3,18 +3,18 @@
3
3
  module.exports = testAssertion;
4
4
 
5
5
  function testAssertion(test, selected, select, xmlDoc, resourceDir, xmlSnippetMaxLength) {
6
- let results = [];
7
-
6
+ const results = [];
7
+
8
8
  for (let i = 0; i < selected.length; i++) {
9
9
  try {
10
- let result = select('boolean(' + test + ')', selected[i]);
10
+ const result = select('boolean(' + test + ')', selected[i]);
11
11
  let lineNumber = null;
12
12
  let xmlSnippet = null;
13
13
  if (selected[i].lineNumber) {
14
14
  lineNumber = selected[i].lineNumber;
15
15
  xmlSnippet = selected[i].toString();
16
16
  }
17
- let maxLength = (xmlSnippetMaxLength || 1e308);
17
+ const maxLength = (xmlSnippetMaxLength || 1e308);
18
18
  if (xmlSnippet && xmlSnippet.length > maxLength) {
19
19
  xmlSnippet = xmlSnippet.slice(0, maxLength) + '...';
20
20
  }
@@ -24,7 +24,7 @@ function testAssertion(test, selected, select, xmlDoc, resourceDir, xmlSnippetMa
24
24
  return { ignored: true, errorMessage: err.message };
25
25
  }
26
26
  }
27
-
27
+
28
28
  for (let i = 0; i < results.length; i++) {
29
29
  if (results[i].result !== true && results[i].result !== false) {
30
30
  return { ignored: true, errorMessage: 'Test returned non-boolean result' };
@@ -33,8 +33,8 @@ function testAssertion(test, selected, select, xmlDoc, resourceDir, xmlSnippetMa
33
33
  return results;
34
34
  }
35
35
 
36
- function getXPath(node, path) {
37
- let top = !path ? true : false;
36
+ function getXPath(node, path) {
37
+ const top = !path ? true : false;
38
38
  path = path || [];
39
39
  if (node.parentNode) {
40
40
  path = getXPath(node.parentNode, path);
@@ -59,7 +59,8 @@ function getXPath(node, path) {
59
59
  if (sibling.nodeType === 1 && sibling.nodeName === node.nodeName) {
60
60
  count = 1;
61
61
  sibling = null;
62
- } else {
62
+ }
63
+ else {
63
64
  count = null;
64
65
  sibling = sibling.previousSibling;
65
66
  }
@@ -70,4 +71,4 @@ function getXPath(node, path) {
70
71
  path.push(node.nodeName + ('[' + (count || 1) + ']'));
71
72
  }
72
73
  return top ? '/' + path.join('/') : path;
73
- }
74
+ }
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "cda-schematron-validator",
3
- "version": "1.1.2",
3
+ "version": "1.1.6",
4
4
  "description": "Fork of Eric Wadkins' javascript implementation of schematron testing for C-CDA XML documents. This includes bug fixes and some house keeping.",
5
5
  "main": "validator.js",
6
6
  "scripts": {
7
- "test": "grunt"
7
+ "test": "grunt",
8
+ "prepare": "husky install"
8
9
  },
9
10
  "repository": {
10
11
  "type": "git",
@@ -29,10 +30,15 @@
29
30
  "homepage": "https://github.com/priyaranjan-tokachichu/cda-schematron-validator#readme",
30
31
  "devDependencies": {
31
32
  "chai": "~4.3.6",
33
+ "eslint": "^8.12.0",
34
+ "eslint-config-google": "^0.14.0",
32
35
  "grunt": "~1.4.1",
33
36
  "grunt-contrib-jshint": "~3.2.0",
34
37
  "grunt-mocha-test": "~0.13.3",
35
- "mocha": "~9.2.2"
38
+ "husky": "~7.0.4",
39
+ "lint-staged": "~12.3.7",
40
+ "mocha": "~9.2.2",
41
+ "prettier": "~2.6.2"
36
42
  },
37
43
  "dependencies": {
38
44
  "@xmldom/xmldom": "~0.7.2",
@@ -3,31 +3,31 @@
3
3
  module.exports = parseSchematron;
4
4
 
5
5
  const xpath = require('xpath');
6
+ const _get = require('lodash.get');
6
7
 
7
- function parseSchematron(doc) {
8
+ function parseSchematron(doc, options) {
8
9
  // Extract data from schematron
9
- let schematronData = extract(doc);
10
-
10
+ const schematronData = extract(doc, options);
11
+
11
12
  return schematronData;
12
13
  }
13
14
 
14
- function extract(doc) {
15
- let namespaceMap = Object.create({});
16
- let patternLevelMap = Object.create({});
17
- let patternRuleMap = Object.create({});
18
- let ruleAssertionMap = Object.create({});
19
-
20
- //// Namespace mapping
21
- let namespaces = xpath.select('//*[local-name()="ns"]', doc);
15
+ function extract(doc, options) {
16
+ const namespaceMap = Object.create({});
17
+ const patternLevelMap = Object.create({});
18
+ const patternRuleMap = Object.create({});
19
+ const ruleAssertionMap = Object.create({});
20
+ // // Namespace mapping
21
+ const namespaces = xpath.select('//*[local-name()="ns"]', doc);
22
22
  for (let i = 0; i < namespaces.length; i++) {
23
23
  namespaceMap[namespaces[i].getAttribute('prefix')] = namespaces[i].getAttribute('uri');
24
24
  }
25
-
26
- //// Pattern to level mapping
27
-
25
+
26
+ // // Pattern to level mapping
27
+
28
28
  // Find errors phases
29
- let errorPhase = xpath.select('//*[local-name()="phase" and @id="errors"]', doc);
30
-
29
+ const errorPhase = xpath.select('//*[local-name()="phase" and @id="errors"]', doc);
30
+
31
31
  // Store error patterns
32
32
  if (errorPhase.length) {
33
33
  for (let i = 0; i < errorPhase[0].childNodes.length; i++) {
@@ -36,30 +36,30 @@ function extract(doc) {
36
36
  }
37
37
  }
38
38
  }
39
-
39
+
40
40
  // Find errors phases
41
- let warningPhase = xpath.select('//*[local-name()="phase" and @id="warnings"]', doc);
42
-
41
+ const warningPhase = xpath.select('//*[local-name()="phase" and @id="warnings"]', doc);
42
+
43
43
  // Store warning patterns
44
- if (warningPhase.length) {
44
+ if (_get(options, 'includeWarnings') && warningPhase.length) {
45
45
  for (let i = 0; i < warningPhase[0].childNodes.length; i++) {
46
46
  if (warningPhase[0].childNodes[i].localName === 'active') {
47
47
  patternLevelMap[warningPhase[0].childNodes[i].getAttribute('pattern')] = 'warning';
48
48
  }
49
49
  }
50
50
  }
51
-
52
- //// Pattern to rule and rule to assertion mapping
53
-
51
+
52
+ // // Pattern to rule and rule to assertion mapping
53
+
54
54
  // Find patterns
55
- let patterns = xpath.select('//*[local-name()="pattern"]', doc);
56
-
55
+ const patterns = xpath.select('//*[local-name()="pattern"]', doc);
56
+
57
57
  // Map patterns to rules
58
58
  for (let i = 0; i < patterns.length; i++) {
59
- let patternId = patterns[i].getAttribute('id');
60
- let defaultLevel = patternLevelMap[patternId] || 'warning';
59
+ const patternId = patterns[i].getAttribute('id');
60
+ const defaultLevel = patternLevelMap[patternId] || 'warning';
61
61
  patternRuleMap[patternId] = [];
62
- let rules = xpath.select('./*[local-name()="rule"]', patterns[i]);
62
+ const rules = xpath.select('./*[local-name()="rule"]', patterns[i]);
63
63
  for (let j = 0; j < rules.length; j++) {
64
64
  patternRuleMap[patternId].push(rules[j].getAttribute('id'));
65
65
  ruleAssertionMap[rules[j].getAttribute('id')] = {
@@ -67,9 +67,9 @@ function extract(doc) {
67
67
  context: parseContext(rules[j].getAttribute('context')),
68
68
  assertionsAndExtensions: getAssertionsAndExtensions(rules[j], defaultLevel)
69
69
  };
70
- }
70
+ }
71
71
  }
72
-
72
+
73
73
  return {
74
74
  namespaceMap: namespaceMap,
75
75
  patternRuleMap: patternRuleMap,
@@ -78,15 +78,15 @@ function extract(doc) {
78
78
  }
79
79
 
80
80
  function getAssertionsAndExtensions(rule, defaultLevel) {
81
- let assertionsAndExtensions = [];
82
-
81
+ const assertionsAndExtensions = [];
82
+
83
83
  // Find and store assertions
84
- let assertions = xpath.select('./*[local-name()="assert"]', rule);
84
+ const assertions = xpath.select('./*[local-name()="assert"]', rule);
85
85
  for (let i = 0; i < assertions.length; i++) {
86
- let description = assertions[i].childNodes[0] ? assertions[i].childNodes[0].data : '';
86
+ const description = assertions[i].childNodes[0] ? assertions[i].childNodes[0].data : '';
87
87
  let level = defaultLevel;
88
- if (description.indexOf('SHALL') !== -1
89
- && (description.indexOf('SHOULD') === -1 || description.indexOf('SHALL') < description.indexOf('SHOULD'))) {
88
+ if (description.indexOf('SHALL') !== -1 &&
89
+ (description.indexOf('SHOULD') === -1 || description.indexOf('SHALL') < description.indexOf('SHOULD'))) {
90
90
  level = 'error';
91
91
  }
92
92
  assertionsAndExtensions.push({
@@ -97,16 +97,16 @@ function getAssertionsAndExtensions(rule, defaultLevel) {
97
97
  description: description
98
98
  });
99
99
  }
100
-
100
+
101
101
  // Find and store extensions
102
- let extensions = xpath.select('./*[local-name()="extends"]', rule);
102
+ const extensions = xpath.select('./*[local-name()="extends"]', rule);
103
103
  for (let i = 0; i < extensions.length; i++) {
104
104
  assertionsAndExtensions.push({
105
105
  type: 'extension',
106
- rule: extensions[i].getAttribute('rule'),
106
+ rule: extensions[i].getAttribute('rule')
107
107
  });
108
108
  }
109
-
109
+
110
110
  return assertionsAndExtensions;
111
111
  }
112
112
 
@@ -119,4 +119,4 @@ function parseAbstract(str) {
119
119
 
120
120
  function parseContext(str) {
121
121
  return str || null;
122
- }
122
+ }
@@ -11,10 +11,10 @@ const schematronPath = './test/test.sch';
11
11
  const xml = fs.readFileSync(xmlPath, 'utf-8').toString();
12
12
  const schematron = fs.readFileSync(schematronPath, 'utf-8').toString();
13
13
 
14
- describe('Validator should', function() {
14
+ describe('Async validator should', function() {
15
15
  let results;
16
16
  it('return results', async function() {
17
- results = await validator.validateAsync(xml, schematron);
17
+ results = await validator.validateAsync(xml, schematron, { includeWarnings: true });
18
18
  expect(results).to.be.an('object');
19
19
  });
20
20
  it('return errorCount', function() {
@@ -53,9 +53,9 @@ describe('Validator should', function() {
53
53
  it('return correct number of ignored', function() {
54
54
  expect(results.ignoredCount).to.be.equal(1);
55
55
  });
56
-
56
+
57
57
  it('return similar results without warnings', async function() {
58
- results = await validator.validateAsync(xml, schematron, { includeWarnings: false });
58
+ results = await validator.validateAsync(xml, schematron);
59
59
  expect(results).to.be.an('object');
60
60
  expect(results.errorCount).to.be.a('number');
61
61
  expect(results.warningCount).to.be.a('number');
@@ -70,9 +70,9 @@ describe('Validator should', function() {
70
70
  expect(results.warningCount).to.be.equal(0);
71
71
  expect(results.ignoredCount).to.be.equal(1);
72
72
  });
73
-
73
+
74
74
  it('return similar results given xml filepath', async function() {
75
- results = await validator.validateAsync(xmlPath, schematron);
75
+ results = await validator.validateAsync(xmlPath, schematron, { includeWarnings: true });
76
76
  expect(results).to.be.an('object');
77
77
  expect(results.errorCount).to.be.a('number');
78
78
  expect(results.warningCount).to.be.a('number');
@@ -87,9 +87,9 @@ describe('Validator should', function() {
87
87
  expect(results.warningCount).to.be.equal(15);
88
88
  expect(results.ignoredCount).to.be.equal(1);
89
89
  });
90
-
90
+
91
91
  it('return similar results given schematron filepath', async function() {
92
- results = await validator.validateAsync(xml, schematronPath);
92
+ results = await validator.validateAsync(xml, schematronPath, { includeWarnings: true });
93
93
  expect(results).to.be.an('object');
94
94
  expect(results.errorCount).to.be.a('number');
95
95
  expect(results.warningCount).to.be.a('number');
@@ -104,9 +104,9 @@ describe('Validator should', function() {
104
104
  expect(results.warningCount).to.be.equal(15);
105
105
  expect(results.ignoredCount).to.be.equal(1);
106
106
  });
107
-
107
+
108
108
  it('return similar results given xml filepath and schematron filepath', async function() {
109
- results = await validator.validateAsync(xmlPath, schematronPath);
109
+ results = await validator.validateAsync(xmlPath, schematronPath, { includeWarnings: true });
110
110
  expect(results).to.be.an('object');
111
111
  expect(results.errorCount).to.be.a('number');
112
112
  expect(results.warningCount).to.be.a('number');
@@ -0,0 +1,37 @@
1
+ const fs = require('fs');
2
+ const expect = require('chai').expect;
3
+
4
+ const validator = require('../validator');
5
+ const path = require('path');
6
+
7
+ // Which xml file to test
8
+ const xmlPath = path.resolve(__dirname, './vitalSigns.xml');
9
+ // Which schematron to test against
10
+ const schematronPath = path.resolve(__dirname, './CDAR2_IG_CCDA_CLINNOTES_R1_DSTU2.1_2015AUG_Vol2_2019JUNwith_errata.sch');
11
+
12
+ const xml = fs.readFileSync(xmlPath, 'utf-8').toString();
13
+ const schematron = fs.readFileSync(schematronPath, 'utf-8').toString();
14
+ const options = {
15
+ resourceDir: path.resolve(__dirname, './'),
16
+ includeWarnings: true
17
+ };
18
+
19
+ describe('Async file list schematron validation should', function() {
20
+ let results;
21
+ it('return results', async function() {
22
+ results = await validator.validateFileListAsync([xml, xml], schematron, options);
23
+ expect(results.length).to.be.equal(2);
24
+ });
25
+ it('return correct number of errors', function() {
26
+ expect(results[0].errorCount).to.be.equal(1);
27
+ expect(results[1].errorCount).to.be.equal(1);
28
+ });
29
+ it('return correct number of warnings', function() {
30
+ expect(results[0].warningCount).to.be.equal(6);
31
+ expect(results[1].warningCount).to.be.equal(6);
32
+ });
33
+ it('return correct number of ignored', function() {
34
+ expect(results[0].ignoredCount).to.be.equal(0);
35
+ expect(results[1].ignoredCount).to.be.equal(0);
36
+ });
37
+ });
package/test/tests.js CHANGED
@@ -2,19 +2,18 @@ const fs = require('fs');
2
2
  const expect = require('chai').expect;
3
3
 
4
4
  const validator = require('../validator');
5
-
5
+ const path = require('path');
6
6
  // Which xml file to test
7
- const xmlPath = './test/test.xml';
7
+ const xmlPath = path.resolve(__dirname, './test.xml');
8
8
  // Which schematron to test against
9
- const schematronPath = './test/test.sch';
10
-
9
+ const schematronPath = path.resolve(__dirname, './test.sch');
11
10
  const xml = fs.readFileSync(xmlPath, 'utf-8').toString();
12
11
  const schematron = fs.readFileSync(schematronPath, 'utf-8').toString();
13
12
 
14
- describe('Validator should', function() {
13
+ describe('Classic validator should', function() {
15
14
  let results;
16
15
  it('return results', function(done) {
17
- results = validator.validate(xml, schematron);
16
+ results = validator.validate(xml, schematron, { includeWarnings: true });
18
17
  expect(results).to.be.an('object');
19
18
  done();
20
19
  });
@@ -66,9 +65,9 @@ describe('Validator should', function() {
66
65
  expect(results.ignoredCount).to.be.equal(1);
67
66
  done();
68
67
  });
69
-
68
+
70
69
  it('return similar results without warnings', function(done) {
71
- results = validator.validate(xml, schematron, { includeWarnings: false });
70
+ results = validator.validate(xml, schematron);
72
71
  expect(results).to.be.an('object');
73
72
  expect(results.errorCount).to.be.a('number');
74
73
  expect(results.warningCount).to.be.a('number');
@@ -84,9 +83,9 @@ describe('Validator should', function() {
84
83
  expect(results.ignoredCount).to.be.equal(1);
85
84
  done();
86
85
  });
87
-
86
+
88
87
  it('return similar results given xml filepath', function(done) {
89
- results = validator.validate(xmlPath, schematron);
88
+ results = validator.validate(xmlPath, schematron, { includeWarnings: true });
90
89
  expect(results).to.be.an('object');
91
90
  expect(results.errorCount).to.be.a('number');
92
91
  expect(results.warningCount).to.be.a('number');
@@ -102,9 +101,9 @@ describe('Validator should', function() {
102
101
  expect(results.ignoredCount).to.be.equal(1);
103
102
  done();
104
103
  });
105
-
104
+
106
105
  it('return similar results given schematron filepath', function(done) {
107
- results = validator.validate(xml, schematronPath);
106
+ results = validator.validate(xml, schematronPath, { includeWarnings: true });
108
107
  expect(results).to.be.an('object');
109
108
  expect(results.errorCount).to.be.a('number');
110
109
  expect(results.warningCount).to.be.a('number');
@@ -120,9 +119,9 @@ describe('Validator should', function() {
120
119
  expect(results.ignoredCount).to.be.equal(1);
121
120
  done();
122
121
  });
123
-
122
+
124
123
  it('return similar results given xml filepath and schematron filepath', function(done) {
125
- results = validator.validate(xmlPath, schematronPath);
124
+ results = validator.validate(xmlPath, schematronPath, { includeWarnings: true });
126
125
  expect(results).to.be.an('object');
127
126
  expect(results.errorCount).to.be.a('number');
128
127
  expect(results.warningCount).to.be.a('number');