@stordata/vsphere-soapify
Advanced tools
Comparing version
@@ -80,3 +80,3 @@ 'use strict'; | ||
function parseBoolean(val) { | ||
return xmlValueOrObject(val) === 'true'; | ||
return typeof val === 'boolean' ? val : xmlValueOrObject(val) === 'true'; | ||
} | ||
@@ -83,0 +83,0 @@ |
@@ -38,2 +38,10 @@ 'use strict'; | ||
it('should parse true as true for "xsd:boolean" type', function() { | ||
expect(parser.parse(true, 'xsd:boolean')).to.equal(true); | ||
}); | ||
it('should parse false as false for "xsd:boolean" type', function() { | ||
expect(parser.parse(false, 'xsd:boolean')).to.equal(false); | ||
}); | ||
it('should parse "false" as false for "xsd:boolean" type', function() { | ||
@@ -66,2 +74,6 @@ expect(parser.parse('false', 'xsd:boolean')).to.equal(false); | ||
it(`should parse ${value} as ${value} for "xsd:${type}" type`, function() { | ||
expect(parser.parse(Number(value), `xsd:${type}`)).to.equal(Number(value)); | ||
}); | ||
}); | ||
@@ -87,2 +99,6 @@ | ||
it('should parse a Date as a Date for "xsd:dateTime" type', function() { | ||
expect(parser.parse(new Date(2019, 0, 1, 12, 34, 45, 678), 'xsd:dateTime')).to.equalTime(new Date(2019, 0, 1, 12, 34, 45, 678)); | ||
}); | ||
it('should parse a valid XML date as a Date for "xsd:dateTime" type', function() { | ||
@@ -432,3 +448,3 @@ expect(parser.parse('2019-01-01', 'xsd:dateTime')).to.equalTime(new Date(2019, 0, 1)); | ||
expect(parsed).to.deep.equal({ | ||
acknowledged: false, | ||
acknowledged: true, | ||
key: 'myAlarm1' | ||
@@ -443,3 +459,3 @@ }); | ||
expect(parsed).to.deep.equal({ | ||
acknowledged: false, | ||
acknowledged: true, | ||
key: 'myAlarm1' | ||
@@ -462,7 +478,7 @@ }); | ||
{ | ||
acknowledged: false, | ||
acknowledged: true, | ||
key: 'myAlarm1' | ||
}, | ||
{ | ||
acknowledged: false, | ||
acknowledged: true, | ||
key: 'myAlarm2' | ||
@@ -647,7 +663,7 @@ } | ||
key: 'myAlarm2', | ||
acknowledged: true | ||
acknowledged: false | ||
}] | ||
}, 'ArrayOfAlarmState')).to.deep.equal([ | ||
{ | ||
acknowledged: false, | ||
acknowledged: true, | ||
key: 'myAlarm1' | ||
@@ -654,0 +670,0 @@ }, |
{ | ||
"name": "@stordata/vsphere-soapify", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "A NodeJS abstraction layer for the vSphere SOAP API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is too big to display
2666512
0.03%134
1.52%5749
0.28%