Skip to content

Commit

Permalink
fix(sort-switch-case): adds tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hugop95 committed Sep 26, 2024
1 parent f45d141 commit b983efc
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions test/sort-switch-case.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,64 @@ describe(ruleName, () => {
],
},
)

ruleTester.run(
`${ruleName}(${type}): allows to use new line as partition`,
rule,
{
valid: [],
invalid: [
{
code: dedent`
switch (x) {
case 'd':
case 'a':
case 'c':
case 'e':
case 'b':
break
}
`,
output: dedent`
switch (x) {
case 'a':
case 'd':
case 'c':
case 'b':
case 'e':
break
}
`,
options: [
{
...options,
partitionByNewLine: true,
},
],
errors: [
{
messageId: 'unexpectedSwitchCaseOrder',
data: {
left: 'd',
right: 'a',
},
},
{
messageId: 'unexpectedSwitchCaseOrder',
data: {
left: 'e',
right: 'b',
},
},
],
},
],
},
)
})

describe(`${ruleName}: sorting by natural order`, () => {
Expand Down

0 comments on commit b983efc

Please sign in to comment.