forked from microsoft/FluidFramework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tree: Cleanup object property tests, and fix bug (microsoft#22748)
## Description This cleans up a section of the object node tests which used schema types in a complicated generic way that's fragile and hard to work with. When rewriting these tests, I focused the new ones on testing aspects that actually have special logic and are likely to break instead of just different value types. Thus the tests now cover the odd normalization cases of numbers. These tests found a couple of issues: - unhydrated node handling of null was incorrect (see changeset) - Some type errors were thrown for invalid user input. TO help keep it easy to tell which errors are our bugs and which are app bugs I've made these fluid usage errors. - A needless check for NaN was included where the check for isFinaite would handle it correctly (Number.isFinite considers NaNs to not be finite: comment already calls out NaN and it has test coverage so this seems like a safe change.)
- Loading branch information
1 parent
a8d7871
commit 6a75bd0
Showing
4 changed files
with
76 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
"@fluidframework/tree": minor | ||
"fluid-framework": minor | ||
--- | ||
--- | ||
"section": tree | ||
--- | ||
|
||
Fix reading of `null` from unhydrated trees | ||
|
||
Unhydrated trees containing object nodes with required fields set to `null` used to throw an error. | ||
This was a bug: `null` is a valid value in tree's whose schema allow it, and this specific case now correctly returns `null` values when appropriate without erroring. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters