Debian Codegraph @

packages/babel-plugin-transform-object-super/test/fixtures/get-set/set-semantics-getter-defined-on-parent/input.js

raw
1 "use strict";
2 const Base = {
3 get test() {
4 return 1;
5 }
6 };
7
8 const obj = {
9 test: 2,
10
11 set() {
12 return super.test = 3;
13 },
14 };
15 Object.setPrototypeOf(obj, Base);
16
17 expect(() => {
18 // this requires helpers to be in file (not external), so they
19 // are in "strict" mode code.
20 obj.set();
21 }).toThrow(TypeError);
22 expect(Base.test).toBe(1);
23 expect(obj.test).toBe(2);