Skip to content

Commit

Permalink
test: updated component test and typescript errors
Browse files Browse the repository at this point in the history
  • Loading branch information
tobi-bams committed Mar 27, 2024
1 parent 6bcbdf4 commit 660f861
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ module.exports = {
markers: ['/'],
},
],
'@typescript-eslint/ban-ts-comment': 'off',
},
settings: {
'import/resolver': {
Expand Down
7 changes: 7 additions & 0 deletions cypress/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/// <reference types="cypress" />

declare namespace Cypress {
interface Chainable {
initialSetup(username?: string, budget?: number): Chainable<void>
}
}
16 changes: 6 additions & 10 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import '@testing-library/cypress/add-commands'

/// <reference types="cypress" />

// @ts-check
/// <reference path="../global.d.ts" />

// ***********************************************
// This example commands.ts shows you how to
// create various custom commands and overwrite
Expand All @@ -26,14 +30,6 @@ import '@testing-library/cypress/add-commands'
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
//
declare global {
namespace Cypress {
interface Chainable {
initialSetup(username?: string, budget?: number): Chainable<void>
}
}
}

Cypress.Commands.add('initialSetup', (username, budget) => {
cy.intercept({
Expand All @@ -59,10 +55,10 @@ Cypress.Commands.add('initialSetup', (username, budget) => {
cy.visit('/', {
onBeforeLoad(win) {
// @ts-ignore
win.CYPRESS_USER = username || ''
win.CYPRESS_USER = username || '' // eslint-disable-line no-param-reassign

// @ts-ignore
win.CYPRESS_USER_BUDGET = budget || 0
win.CYPRESS_USER_BUDGET = budget || 0 // eslint-disable-line no-param-reassign
},
})

Expand Down

0 comments on commit 660f861

Please sign in to comment.