Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Fix load() implementation of transportable object #216

Merged
merged 4 commits into from
Apr 19, 2018

Conversation

fs-eire
Copy link
Contributor

@fs-eire fs-eire commented Apr 4, 2018

This bug is revealed from #209. Thanks to @nveenjain for bug report.


Current AutoTransportable left its load() function an empty body. The comment says that unmarshalling is already done at that time, which is true. However we should assign the properties from payload back to this object, which is missing.

The class CanPass in the test is of the same problem. The reason why this is not caught by test cases is due to a wrong implementation of function testMarshallUnmarshall(). It uses .toString() to inspect objects, so we will always find the result to be "[object Object]", without any dump of its members.

After adding JSON.stringify and util.inspect as additional way to compare objects, the case failed. And then it is fixed by update the load() implementation.


Type AutoTransportable is put public from transport.ts.

@helloshuangzi
Copy link
Contributor

It would be better to have a test case or an example of AutoTransportable

@fs-eire fs-eire merged commit 9c9d8f6 into microsoft:master Apr 19, 2018
@fs-eire fs-eire deleted the fix-auto-transport branch April 19, 2018 00:43
helloshuangzi pushed a commit to helloshuangzi/napajs that referenced this pull request Apr 25, 2018
* Fix load() implementation of transportable object

* Add a test case for AutoTransport
fs-eire added a commit to fs-eire/napajs that referenced this pull request May 14, 2018
* Fix load() implementation of transportable object

* Add a test case for AutoTransport
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants