Skip to content

Commit

Permalink
chore: Fix sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
mskelton committed May 17, 2024
1 parent b0fb7cd commit f7c9214
Showing 1 changed file with 59 additions and 59 deletions.
118 changes: 59 additions & 59 deletions src/rules/prefer-web-first-assertions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ runRuleTester('prefer-web-first-assertions', rule, {
const isTweetVisible = await page.locator(".tweet").isVisible()
expect(isTweetVisible).toBe(true)
`),
output: test(`
const unrelatedAssignment = 'unrelated'
const isTweetVisible = page.locator(".tweet")
await expect(isTweetVisible).toBeVisible()
`),
errors: [
{
column: 9,
Expand All @@ -53,18 +48,18 @@ runRuleTester('prefer-web-first-assertions', rule, {
messageId: 'useWebFirstAssertion',
},
],
output: test(`
const unrelatedAssignment = 'unrelated'
const isTweetVisible = page.locator(".tweet")
await expect(isTweetVisible).toBeVisible()
`),
},
{
code: test(`
const unrelatedAssignment = 'unrelated'
const isTweetVisible = await page.locator(".tweet").isVisible()
expect(isTweetVisible).toBe(false)
`),
output: test(`
const unrelatedAssignment = 'unrelated'
const isTweetVisible = page.locator(".tweet")
await expect(isTweetVisible).toBeHidden()
`),
errors: [
{
column: 9,
Expand All @@ -74,18 +69,18 @@ runRuleTester('prefer-web-first-assertions', rule, {
messageId: 'useWebFirstAssertion',
},
],
output: test(`
const unrelatedAssignment = 'unrelated'
const isTweetVisible = page.locator(".tweet")
await expect(isTweetVisible).toBeHidden()
`),
},
{
code: test(`
const locatorFoo = page.locator(".foo")
const isBarVisible = await locatorFoo.locator(".bar").isVisible()
expect(isBarVisible).toBe(false)
`),
output: test(`
const locatorFoo = page.locator(".foo")
const isBarVisible = locatorFoo.locator(".bar")
await expect(isBarVisible).toBeHidden()
`),
errors: [
{
column: 9,
Expand All @@ -95,18 +90,18 @@ runRuleTester('prefer-web-first-assertions', rule, {
messageId: 'useWebFirstAssertion',
},
],
output: test(`
const locatorFoo = page.locator(".foo")
const isBarVisible = locatorFoo.locator(".bar")
await expect(isBarVisible).toBeHidden()
`),
},
{
code: test(`
const locatorFoo = page.locator(".foo")
const isBarVisible = await locatorFoo.locator(".bar").isVisible()
expect(isBarVisible).toBe(true)
`),
output: test(`
const locatorFoo = page.locator(".foo")
const isBarVisible = locatorFoo.locator(".bar")
await expect(isBarVisible).toBeVisible()
`),
errors: [
{
column: 9,
Expand All @@ -116,6 +111,11 @@ runRuleTester('prefer-web-first-assertions', rule, {
messageId: 'useWebFirstAssertion',
},
],
output: test(`
const locatorFoo = page.locator(".foo")
const isBarVisible = locatorFoo.locator(".bar")
await expect(isBarVisible).toBeVisible()
`),
},
{
code: test(
Expand Down Expand Up @@ -391,11 +391,6 @@ runRuleTester('prefer-web-first-assertions', rule, {
const fooLocatorText = await fooLocator.textContent();
expect(fooLocatorText).toEqual('foo');
`),
output: test(`
const fooLocator = page.locator('.fooClass');
const fooLocatorText = fooLocator;
await expect(fooLocatorText).toHaveText('foo');
`),
errors: [
{
column: 9,
Expand All @@ -405,6 +400,11 @@ runRuleTester('prefer-web-first-assertions', rule, {
messageId: 'useWebFirstAssertion',
},
],
output: test(`
const fooLocator = page.locator('.fooClass');
const fooLocatorText = fooLocator;
await expect(fooLocatorText).toHaveText('foo');
`),
},
{
code: test(`
Expand All @@ -414,13 +414,6 @@ runRuleTester('prefer-web-first-assertions', rule, {
fooLocatorText = 'foo';
expect(fooLocatorText).toEqual('foo');
`),
output: test(`
const fooLocator = page.locator('.fooClass');
let fooLocatorText = fooLocator;
await expect(fooLocatorText).toHaveText('foo');
fooLocatorText = 'foo';
expect(fooLocatorText).toEqual('foo');
`),
errors: [
{
column: 9,
Expand All @@ -430,6 +423,13 @@ runRuleTester('prefer-web-first-assertions', rule, {
messageId: 'useWebFirstAssertion',
},
],
output: test(`
const fooLocator = page.locator('.fooClass');
let fooLocatorText = fooLocator;
await expect(fooLocatorText).toHaveText('foo');
fooLocatorText = 'foo';
expect(fooLocatorText).toEqual('foo');
`),
},
{
code: test(`
Expand All @@ -439,13 +439,6 @@ runRuleTester('prefer-web-first-assertions', rule, {
fooLocatorText = await fooLocator.textContent();
expect(fooLocatorText).toEqual('foo');
`),
output: test(`
let fooLocatorText;
const fooLocator = page.locator('.fooClass');
fooLocatorText = 'Unrelated';
fooLocatorText = fooLocator;
await expect(fooLocatorText).toHaveText('foo');
`),
errors: [
{
column: 9,
Expand All @@ -455,6 +448,13 @@ runRuleTester('prefer-web-first-assertions', rule, {
messageId: 'useWebFirstAssertion',
},
],
output: test(`
let fooLocatorText;
const fooLocator = page.locator('.fooClass');
fooLocatorText = 'Unrelated';
fooLocatorText = fooLocator;
await expect(fooLocatorText).toHaveText('foo');
`),
},
{
code: test(`
Expand All @@ -465,14 +465,6 @@ runRuleTester('prefer-web-first-assertions', rule, {
fooLocatorText2 = await fooLocator.textContent();
expect(fooLocatorText).toEqual('foo');
`),
output: test(`
let fooLocatorText;
let fooLocatorText2;
const fooLocator = page.locator('.fooClass');
fooLocatorText = fooLocator;
fooLocatorText2 = await fooLocator.textContent();
await expect(fooLocatorText).toHaveText('foo');
`),
errors: [
{
column: 9,
Expand All @@ -482,6 +474,14 @@ runRuleTester('prefer-web-first-assertions', rule, {
messageId: 'useWebFirstAssertion',
},
],
output: test(`
let fooLocatorText;
let fooLocatorText2;
const fooLocator = page.locator('.fooClass');
fooLocatorText = fooLocator;
fooLocatorText2 = await fooLocator.textContent();
await expect(fooLocatorText).toHaveText('foo');
`),
},
{
code: test(`
Expand All @@ -491,13 +491,6 @@ runRuleTester('prefer-web-first-assertions', rule, {
fooLocatorText = await page.locator('.fooClass').textContent();
expect(fooLocatorText).toEqual('foo');
`),
output: test(`
let fooLocatorText;
fooLocatorText = 'foo';
expect(fooLocatorText).toEqual('foo');
fooLocatorText = page.locator('.fooClass');
await expect(fooLocatorText).toHaveText('foo');
`),
errors: [
{
column: 9,
Expand All @@ -507,18 +500,20 @@ runRuleTester('prefer-web-first-assertions', rule, {
messageId: 'useWebFirstAssertion',
},
],
output: test(`
let fooLocatorText;
fooLocatorText = 'foo';
expect(fooLocatorText).toEqual('foo');
fooLocatorText = page.locator('.fooClass');
await expect(fooLocatorText).toHaveText('foo');
`),
},
{
code: test(`
const unrelatedAssignment = "unrelated";
const fooLocatorText = await page.locator('.foo').textContent();
expect(fooLocatorText).toEqual('foo');
`),
output: test(`
const unrelatedAssignment = "unrelated";
const fooLocatorText = page.locator('.foo');
await expect(fooLocatorText).toHaveText('foo');
`),
errors: [
{
column: 9,
Expand All @@ -528,6 +523,11 @@ runRuleTester('prefer-web-first-assertions', rule, {
messageId: 'useWebFirstAssertion',
},
],
output: test(`
const unrelatedAssignment = "unrelated";
const fooLocatorText = page.locator('.foo');
await expect(fooLocatorText).toHaveText('foo');
`),
},

// isChecked
Expand Down

0 comments on commit f7c9214

Please sign in to comment.