packages/babel-plugin-proposal-object-rest-spread/test/fixtures/assumption-pureGetters/spread-single-call/exec.js
raw| 1 | let count = 0; |
| 2 | |
| 3 | let withFoo = { get foo() { return count++; } }; |
| 4 | let withBar = { get bar() { return count++; } }; |
| 5 | |
| 6 | let res = { ...withFoo, middle: count, ...withBar }; |
| 7 | |
| 8 | // Without assuming that getters are pure (in this case it isn't), |
| 9 | // the result should be { foo: 0, middle: 1, bar: 1 } |
| 10 | expect(res).toEqual({ foo: 0, middle: 0, bar: 1 }); |