Commit f569eb4
Fix "does not have field" assertion to accept undefined (#3922)
ObjectSerializer.deserialize() always assigns `instance[attr] = undefined`
for optional fields absent from the JSON response, so the property key
exists on the object even when the field was not present. Chai's
`.not.have.property()` uses hasOwnProperty() which returns true for
undefined-valued keys, causing the assertion to fail.
Treat a property value of `undefined` as equivalent to "field not present"
by asserting the value `.to.be.undefined` instead of checking key existence.
Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>1 parent 8bdd5b9 commit f569eb4
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
307 | 307 | | |
308 | 308 | | |
309 | 309 | | |
310 | | - | |
| 310 | + | |
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
| |||
0 commit comments