Skip to content

Commit

Permalink
fix: should reset _classRefFields (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 authored Aug 3, 2018
1 parent f71da69 commit 3f0b392
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/v2/encoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ function Encoder(options) {
EncoderV1.call(this, options);

this._classRefs = [];
this._typeRefs = [];
this._classRefFields = {};
this._typeRefs = [];
}

util.inherits(Encoder, EncoderV1);
Expand Down
9 changes: 5 additions & 4 deletions test/v2.list.encode.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ var utils = require('../lib/utils');
var java = require('js-to-java');

describe('hessian v2', function () {

it('v2 list encode should ok', function() {

it('v2 list encode should ok', function () {
var arg = {
"$class": "com.x.Site",
"$": {
Expand Down Expand Up @@ -205,6 +203,9 @@ describe('hessian v2', function () {
var rs = hessian.decode(bytes, '2.0');
assert.deepEqual(java.revert(arg), rs);

hessian.encoderV2.reset();
assert(hessian.encoderV2._classRefs.length === 0);
assert(hessian.encoderV2._typeRefs.length === 0);
assert(Object.keys(hessian.encoderV2._classRefFields).length === 0);
});

});

0 comments on commit 3f0b392

Please sign in to comment.