-
Notifications
You must be signed in to change notification settings - Fork 6
Fix deep object acess #1
base: master
Are you sure you want to change the base?
Conversation
Ah, I forgot to mention, that I also removed some try to hack typescript, because they aren't needed. Wish that you use semicolons, but that is another story. ;) |
@@ -97,7 +97,7 @@ export interface RecordAckMessage extends RecordMessage { | |||
} | |||
|
|||
export interface ParseError { | |||
parseError: boolean | |||
parseError: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this breaks in node 6 sadly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will review this on the next weekend.
@@ -17,7 +17,7 @@ describe('message parser', () => { | |||
} | |||
it (`parses ${TOPIC[topic]} messages ${authAction} correctly`, () => { | |||
const result = parse(spec.urp.value)[0] | |||
expect(result.parseError).to.be.undefined | |||
expect(result.parseError).to.be.an('undefined') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whats the difference with these out of curiosity?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one
expect(result.parseError).to.be.undefined
hides information of an method call in an getter method called when you call an attribute. This might be fine, but on a reviewer perspective I'm not able to predict side effects or able to jump in the method, which is called by accessing the attribute. I'm also not so happy with my one, because it mixes types, which is also a problem. This one was provided as a solution on the documentation of chai in bdd style.
On my opinion the best is to switch to the assert methods which are also provided by chai. The isUndefined-method should do what expected.
Hi,
I fixed a possible deep object acess problem, where we could not predict if the first object has a value on the property. That could cause in an error thrown by the engine.
The second fix is in the test definition, where the test against undefined object did not call the awaited function. Thats why nothing is tested in these test cases.
I added
.idea
for the Intelij IDE to.gitignore
. Hope this is ok.Have a nice Weekend,
Thomas