Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert decimals #1118

Merged
merged 1 commit into from
Jul 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/wsdl/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ export class WSDL {
} else {
if (name === 'int' || name === 'integer') {
value = parseInt(text, 10);
} else if (name === 'double' || name === 'float') {
} else if (name === 'double' || name === 'float' || name === 'decimal') {
value = Number(text);
} else if (name === 'bool' || name === 'boolean') {
value = text.toLowerCase() === 'true' || text === '1';
Expand Down
5 changes: 3 additions & 2 deletions test/server-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test.service = {
}
};
} else {
return { price: 19.56, tax: -1.23 };
return { price: 19.56, tax: -1.23, other: 20.001 };
}
},

Expand Down Expand Up @@ -256,7 +256,7 @@ describe('SOAP Server', function() {
soap.createClient(test.baseUrl + '/stockquote?wsdl', function(err, client) {
assert.ifError(err);
var description = client.describe(),
expected = { input: { tickerSymbol: "string" }, output:{ price: "float", tax: "double" } };
expected = { input: { tickerSymbol: "string" }, output:{ price: "float", tax: "double", other: "decimal" } };
assert.deepEqual(expected , description.StockQuoteService.StockQuotePort.GetLastTradePrice);
done();
});
Expand All @@ -269,6 +269,7 @@ describe('SOAP Server', function() {
assert.ifError(err);
assert.strictEqual(19.56, result.price); // float
assert.strictEqual(-1.23, result.tax); // double
assert.strictEqual(20.001, result.other); // decimal
done();
});
});
Expand Down
1 change: 1 addition & 0 deletions test/wsdl/strict/stockquote.wsdl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<xsd:all>
<xsd:element name="price" type="float"/>
<xsd:element name="tax" type="double"/>
<xsd:element name="other" type="decimal"/>
</xsd:all>
</xsd:complexType>
</xsd:element>
Expand Down