[docs] KeepSafe: Analysis, review, lessons, and G0.11 closed
This commit is contained in:
@@ -118,3 +118,16 @@ the one case that matters.
|
||||
**How to apply it.** For each condition, write the case where only it decides (from
|
||||
0.39 a full can overshoots: needed, too full). For an order property, add one fixed
|
||||
log where order changes the answer. Then put the bug back and watch the test fail.
|
||||
|
||||
## `toEqual` cannot see a field that is `undefined`
|
||||
|
||||
**What happened.** On 2026-11-02 a drill made the rose's export file carry an extra field
|
||||
taken from the identity. The test passed: it kept no identity, so the field was
|
||||
`undefined`; `toEqual` treats a missing property and an undefined one as equal, and
|
||||
`JSON.stringify` drops it, so the text check saw nothing either.
|
||||
|
||||
**Why it bit.** "Nothing else in it" is a claim about absent fields, and the default
|
||||
equality is blind to exactly the field that is absent by accident.
|
||||
|
||||
**How to apply it.** For "holds this and nothing else", use `toStrictEqual`, and give the
|
||||
test something real to leak (here, a kept identity).
|
||||
|
||||
Reference in New Issue
Block a user