Skip to content
This repository was archived by the owner on Jan 7, 2021. It is now read-only.

Commit 52e5df3

Browse files
committed
Updates coercion fixtures to fix broken tests.
1 parent 22fee58 commit 52e5df3

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

test/fixtures/coerce.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"itemRecord":{"value":[{"longValue":"12345"},{"stringValue":{"number":"false","$t":"this is a string value"}},{"moneyValue":{"number":"true","currencyId":"USD","$t":"104.95"}},{"moneyValue":{"currencyId":"USD","$t":"104.95"}},{"longValue":"0","bool":{"id":"0","$t":"true"}},{"longValue":"0"},{"dateValue":"2012-02-16T17:03:33.000-07:00"},{"stringValue":"SmDZ8RlMIjDvlEW3KUibzj2Q"}]}}
1+
{"itemRecord":{"value":[{"longValue":"12345"},{"stringValue":{"number":"false","$t":"this is a string value"}},{"moneyValue":{"number":"true","currencyId":"USD","text":"123.45","$t":"104.95"}},{"moneyValue":{"currencyId":"USD","$t":"104.95"}},{"longValue":"0","bool":{"id":"0","$t":"true"}},{"longValue":"0"},{"dateValue":"2012-02-16T17:03:33.000-07:00"},{"stringValue":"SmDZ8RlMIjDvlEW3KUibzj2Q"},{"text":"42.42"}]}}

test/test-coerce.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ assert.strictEqual(result.itemRecord.value[2].moneyValue['$t'], '104.95');
2626
assert.strictEqual(result.itemRecord.value[2].moneyValue.text, '123.45');
2727
assert.strictEqual(result.itemRecord.value[8].text['$t'], '42.42');
2828

29-
// With coercien as an optional object
29+
// With coercion as an optional object
3030
var result = parser.toJson(data, {reversible: true, coerce: {text:String}, object: true});
3131
assert.strictEqual(result.itemRecord.value[0].longValue['$t'], 12345);
3232
assert.strictEqual(result.itemRecord.value[1].stringValue.number, false);

test/test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ fs.readdir(fixturesPath, function(err, files) {
3737
if (expected) {
3838
expected = expected.trim();
3939
}
40+
// console.log('============ Got ===============');
4041
// console.log(result);
4142
// console.log('============ Expected ===============');
4243
// console.log(expected)
44+
// console.log('=====================================');
4345
assert.deepEqual(result, expected, jsonFile + ' and ' + file + ' are different');
4446
console.log('[xml2json: ' + file + '->' + jsonFile + '] passed!');
4547
} else if( ext == '.json') {

0 commit comments

Comments
 (0)