Skip to content
Myr

chore: Add failing test Set ordering #819 (#820)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* Add failing test * Move test to map-set * Add string variant of first test

authored by Chris Santamaria · committed by GitHub · parent b3eeb69 · Browse files · 1 file+35 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+35 added−0 removed

  • tests:+35 added−0 removed

1 file+35 added−0 removed

modified:__tests__/map-set.js+35 added
293 unmodified lines
294 mapType2 = draft.constructor295 })296 expect(mapType1).toBe(mapType2)297 })298299 test("#819 - Set with object maintains order when adding object", () => {300 const items = [301 {302 id: "a"303 },304 {305 id: "b"306 }307 ]308309 const set = new Set([items[0]])310 const newSet = produce(set, draft => {311 draft.add(items[1])312 })313314 expect(Array.from(newSet)).toEqual([items[0], items[1]])315 })316317 // More specific varaint of above test covering case of adding non-object item318 test("#819 - Set with object maintains order when adding string", () => {319 const items = [320 {321 id: "a"322 },323 "b"324 ]325326 const set = new Set([items[0]])327 const newSet = produce(set, draft => {328 draft.add(items[1])329 })330331 expect(Array.from(newSet)).toEqual([items[0], items[1]])332 })333 })334 describe("set issues " + name, () => {335 test("#819.A - maintains order when adding", () => {336 const objs = [
32 unmodified lines