Skip to content

Commit e9d2f1e

Browse files
committed
test(unbound-method): update cases and structure
1 parent 191e892 commit e9d2f1e

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

src/rules/__tests__/unbound-method.test.ts

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ ruleTester.run('unbound-method', requireRule(false), {
230230
"['1', '2', '3'].map(Number.parseInt);",
231231
'[5.2, 7.1, 3.6].map(Math.floor);',
232232
'const x = console.log;',
233+
'const x = Object.defineProperty;',
233234
...[
234235
'instance.bound();',
235236
'instance.unbound();',
@@ -762,5 +763,59 @@ class OtherClass extends BaseClass {
762763
},
763764
],
764765
},
766+
{
767+
code: `
768+
const values = {
769+
a() {},
770+
b: () => {},
771+
};
772+
773+
const { a, b } = values;
774+
`,
775+
errors: [
776+
{
777+
line: 7,
778+
column: 9,
779+
endColumn: 10,
780+
messageId: 'unboundWithoutThisAnnotation',
781+
},
782+
],
783+
},
784+
{
785+
code: `
786+
const values = {
787+
a() {},
788+
b: () => {},
789+
};
790+
791+
const { a: c } = values;
792+
`,
793+
errors: [
794+
{
795+
line: 7,
796+
column: 9,
797+
endColumn: 10,
798+
messageId: 'unboundWithoutThisAnnotation',
799+
},
800+
],
801+
},
802+
{
803+
code: `
804+
const values = {
805+
a() {},
806+
b: () => {},
807+
};
808+
809+
const { b, a } = values;
810+
`,
811+
errors: [
812+
{
813+
line: 7,
814+
column: 12,
815+
endColumn: 13,
816+
messageId: 'unboundWithoutThisAnnotation',
817+
},
818+
],
819+
},
765820
],
766821
});

0 commit comments

Comments
 (0)