Allow custom comparisons of property values#33
Conversation
Codecov Report
@@ Coverage Diff @@
## master #33 +/- ##
==========================================
+ Coverage 98.03% 98.58% +0.54%
==========================================
Files 10 10
Lines 610 705 +95
Branches 137 167 +30
==========================================
+ Hits 598 695 +97
+ Misses 6 4 -2
Partials 6 6
Continue to review full report at Codecov.
|
[ci skip]
| * an object | ||
| */ | ||
| export interface UnamedConstructRecord { | ||
| /** |
There was a problem hiding this comment.
Any arguments to pass the constructor function -> Any arguments to pass to the constructor function ?
|
|
||
| /** | ||
| * A record that describes how to instantiate a new object via a constructor function | ||
| * @param Ctor The constructor function |
There was a problem hiding this comment.
Any arguments to be passed the constructor function -> Any arguments to be passed to the constructor function ?
| return target; | ||
| } | ||
|
|
||
| /** |
There was a problem hiding this comment.
Creates a function which when placed in an expected render will call the callback -> Creates a function which, when placed in an expected render, will call the callback
src/support/d.ts
Outdated
| } | ||
|
|
||
| /** | ||
| * Creates a function which when placed in an expected render will call the `callback`. If the `callback` returns `true`, the value |
There was a problem hiding this comment.
and expected render will fail. -> and the expected render will fail.
[ci skip]
… into feature-complex-compare
| new (...args: any[]): object; | ||
| prototype: object; | ||
| } | ||
|
|
There was a problem hiding this comment.
do you want some tsdoc for this exported interface?
agubler
left a comment
There was a problem hiding this comment.
Small doc nit but otherwise looks to add the inline comparison that we need for complex, unknown properties.
to something more logical.
Type: feature
The following has been addressed in the PR:
Description:
This PR adds some features to enable custom comparisons of property values, specifically in
harness.expectRender():support/compare/CustomDiff, allowing the comparison of non-plain objects and custom comparison of primitives.support/compare/diffandsupport/compare/patchto support theConstructRecordwhich allows for diffing and patching of non-plain Objects.support/d/comparePropertywhich wraps a function that returnstrueorfalseinto aCustomDifffunction.As properties are compared via
diff, if it encounters aCustomDiffit will off-load the comparison. In the case of rendering, instead of returning a patch record, theCustomDiffwill simply throw when the test function returnsfalseindicating the value is unexpected.Resolves #32