-
Notifications
You must be signed in to change notification settings - Fork 46
Conversation
Thanks! Let's also add at least one integration test for this? |
- Add support for simple object literals - Follows nesting rules of arrays - Remove old object test, add several integration tests for objects. Fixes mockdeep#19 Courtesy of #goodnessSquad
f4aaf5f
to
65639aa
Compare
- Currently runs them through JSON.stringify(), might want to look at other solutions for folks who want single quotes - Also add test for that.
So that things like yarn-error.log don't get committed by accident.
@@ -3,3 +3,4 @@ dist | |||
node_modules | |||
.idea | |||
assets/typewiz.psd | |||
*.log |
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.
👍
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.
Is this a request for change?
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.
nope :)
src/type-collector-snippet.ts
Outdated
} | ||
|
||
return typeof value; | ||
} | ||
|
||
function getObjectTypes(obj: any, nest: number): string { | ||
const keys = Object.keys(obj); |
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.
Let's sort the keys so we always get the same result for objects of the same shape.
e.g. given either of the following inputs:
Object.keys({ a: 1, b : 2 }) // ["a", "b"]
Object.keys({ b: 1, a : 2 }) // ["b", "a"]
we'd like to get the same output (let's also add a test case covering this)
- Ensures more consistent results - Modify unit test and integration tests to match.
Thanks! |
Released as part of 0.7.0 |
Fixes #19
Add support for object types inference.
#goodnessSquad