Skip to content

Commit

Permalink
Add some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Cena committed Aug 6, 2022
1 parent 4534101 commit ab5313b
Showing 1 changed file with 86 additions and 0 deletions.
86 changes: 86 additions & 0 deletions packages/eslint-plugin/tests/rules/member-ordering.test.ts
Expand Up @@ -1264,6 +1264,16 @@ class Foo {
`,
options: [{ default: ['method', 'field', 'static-initialization'] }],
},
{
code: `
class Foo {
f = 1;
static {}
m() {}
}
`,
options: [{ default: ['field', 'static-initialization', 'method'] }],
},
`
interface Foo {
[Z: string]: any;
Expand Down Expand Up @@ -4050,6 +4060,82 @@ class Foo {
},
],
},
{
code: `
class Foo {
f = 1;
static {}
m() {}
}
`,
options: [{ default: ['static-initialization', 'field', 'method'] }],
errors: [
{
messageId: 'incorrectGroupOrder',
data: {
name: 'static block',
rank: 'field',
},
line: 4,
column: 3,
},
],
},
{
code: `
class Foo {
static {}
f = 1;
m() {}
}
`,
options: [{ default: ['field', 'static-initialization', 'method'] }],
errors: [
{
messageId: 'incorrectGroupOrder',
data: {
name: 'f',
rank: 'static initialization',
},
line: 4,
column: 3,
},
],
},
{
code: `
class Foo {
private mp() {}
static {}
public m() {}
@dec
md() {}
}
`,
options: [
{ default: ['decorated-method', 'static-initialization', 'method'] },
],
errors: [
{
messageId: 'incorrectGroupOrder',
data: {
name: 'static block',
rank: 'method',
},
line: 4,
column: 3,
},
{
messageId: 'incorrectGroupOrder',
data: {
name: 'md',
rank: 'method',
},
line: 6,
column: 3,
},
],
},
],
};

Expand Down

0 comments on commit ab5313b

Please sign in to comment.