This repository was archived by the owner on Jun 13, 2024. It is now read-only.
Fix load() implementation of transportable object #216
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 frompayload
back tothis
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 functiontestMarshallUnmarshall()
. 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
andutil.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.