Skip to content

Commit

Permalink
test: improve test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
azat-io committed Jul 20, 2024
1 parent 19167b8 commit ba40064
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions test/sort-named-imports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,47 @@ describe(ruleName, () => {
],
},
)

ruleTester.run(`${ruleName}: allows to use original import names`, rule, {
valid: [
{
code: dedent`
import { A as B, B as A } from 'module'
`,
options: [
{
...options,
ignoreAlias: true,
},
],
},
],
invalid: [
{
code: dedent`
import { B as A, A as B } from 'module'
`,
output: dedent`
import { A as B, B as A } from 'module'
`,
options: [
{
...options,
ignoreAlias: true,
},
],
errors: [
{
messageId: 'unexpectedNamedImportsOrder',
data: {
left: 'B',
right: 'A',
},
},
],
},
],
})
})

describe(`${ruleName}: sorting by natural order`, () => {
Expand Down Expand Up @@ -706,6 +747,47 @@ describe(ruleName, () => {
],
},
)

ruleTester.run(`${ruleName}: allows to use original import names`, rule, {
valid: [
{
code: dedent`
import { A as B, B as A } from 'module'
`,
options: [
{
...options,
ignoreAlias: true,
},
],
},
],
invalid: [
{
code: dedent`
import { B as A, A as B } from 'module'
`,
output: dedent`
import { A as B, B as A } from 'module'
`,
options: [
{
...options,
ignoreAlias: true,
},
],
errors: [
{
messageId: 'unexpectedNamedImportsOrder',
data: {
left: 'B',
right: 'A',
},
},
],
},
],
})
})

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

0 comments on commit ba40064

Please sign in to comment.