Skip to content

Commit

Permalink
chore: fix lint errors on tests
Browse files Browse the repository at this point in the history
  • Loading branch information
victorcg88 committed Nov 26, 2024
1 parent 7e7d894 commit 828836a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
10 changes: 0 additions & 10 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,4 @@ export default empathyco(
'ts/no-unsafe-member-access': 'off',
},
},
{
files: ['tests/**/*.{ts,tsx,vue}'],
rules: {
// Enable the following rules progressively when the project is ready to enforce them
'ts/no-unsafe-call': 'off',
'ts/no-unsafe-argument': 'off',
'ts/no-unsafe-member-access': 'off',
'ts/no-unsafe-return': 'off',
},
},
)
3 changes: 2 additions & 1 deletion tests/e2e/cucumber/common-steps.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { XAPI } from '@empathyco/x-components'
import { Given, Then, When } from '@badeball/cypress-cucumber-preprocessor'
import ViewportPreset = Cypress.ViewportPreset

Expand All @@ -8,7 +9,7 @@ Given('start page with {string} size view', (view: ViewportPreset) => {

Then('search bar is clicked', () => {
cy.getByDataTest('x').should('exist')
cy.window().then(window => window.InterfaceX.search())
cy.window().then(window => (window.InterfaceX as XAPI).search())
})

// Search
Expand Down
5 changes: 3 additions & 2 deletions tests/e2e/cucumber/facets.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { TestContext } from '../support'
import { Then, When } from '@badeball/cypress-cucumber-preprocessor'
import '../cucumber/global-definitions'

Expand Down Expand Up @@ -31,7 +32,7 @@ When('filter {int} from facet {string} is clicked', (filterNumber: number, facet

Then(
'filter {int} from facet {string} is selected is {boolean}',
function (this: any, filterNumber: number, facetName: string, isSelected: boolean) {
function (this: TestContext, filterNumber: number, facetName: string, isSelected: boolean) {
cy.getByDataTest(facetName)
.contains(this[`clickedFilter${filterNumber}`].trim())
.should(`${isSelected ? '' : 'not.'}to.have.class`, 'x-selected')
Expand Down Expand Up @@ -67,7 +68,7 @@ When(
Then(
'selection status of child filter {int} from parent filter {int} in facet {string} is {boolean}',
function (
this: any,
this: TestContext,
childFilterIndex: number,
hierarchicalFilterIndex: number,
facetName: string,
Expand Down
4 changes: 4 additions & 0 deletions tests/e2e/support/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import Withinable = Cypress.Withinable
*/
Cypress.on('uncaught:exception', err => !err.message.includes('ResizeObserver loop limit exceeded'))

export interface TestContext {
[key: string]: string
}

export interface CustomCommands {
/**
* Searches a query by typing it in the search input and pressing enter.
Expand Down

0 comments on commit 828836a

Please sign in to comment.