Skip to content

Commit 3f0b392

Browse files
authored
1 parent f71da69 commit 3f0b392

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

lib/v2/encoder.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ function Encoder(options) {
1313
EncoderV1.call(this, options);
1414

1515
this._classRefs = [];
16-
this._typeRefs = [];
1716
this._classRefFields = {};
17+
this._typeRefs = [];
1818
}
1919

2020
util.inherits(Encoder, EncoderV1);

test/v2.list.encode.test.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ var utils = require('../lib/utils');
88
var java = require('js-to-java');
99

1010
describe('hessian v2', function () {
11-
12-
it('v2 list encode should ok', function() {
13-
11+
it('v2 list encode should ok', function () {
1412
var arg = {
1513
"$class": "com.x.Site",
1614
"$": {
@@ -205,6 +203,9 @@ describe('hessian v2', function () {
205203
var rs = hessian.decode(bytes, '2.0');
206204
assert.deepEqual(java.revert(arg), rs);
207205

206+
hessian.encoderV2.reset();
207+
assert(hessian.encoderV2._classRefs.length === 0);
208+
assert(hessian.encoderV2._typeRefs.length === 0);
209+
assert(Object.keys(hessian.encoderV2._classRefFields).length === 0);
208210
});
209-
210211
});

0 commit comments

Comments
 (0)