debian-image-builder-frontend/.eslintrc.yml
Aleksandar Todorov 7639452298 tests: Spy on history.push instead of trying to assert page change
When the SUT calls history.push that will cause a page redirect
inside the browser. However it doesn't cause the new page to be
rendered when running the test suite hence all assertions fail!

The reason for this is that Jest + RTL use jsdom under the hood,
which partially implements HTML/DOM APIs but **IS NOT** a browser!

It also turns out RTL is not well suited for end-to-end scenarios
which cover multiple pages.

This commit:

- patches renderWithReduxRouter() to also return the history object
  so we can set a spy on it later
- changes eslint confirugration to ignore unused variables starting
  with underscore
- updates the verifyCancelButton() function and scenarios which
  make use of it
2020-11-30 13:32:40 +02:00

129 lines
2.1 KiB
YAML

parser: babel-eslint
env:
browser: true
node: true
es6: true
settings:
react:
version: '16.0'
extends:
- 'eslint:recommended'
- 'prettier'
- 'plugin:react/recommended'
parserOptions:
ecmaVersion: 7
sourceType: module
globals:
beforeAll: true
describe: true
expect: true
global: true
insights: true
it: true
mount: true
process: true
render: true
shallow: true
React: true
rules:
array-bracket-spacing:
- error
- always
- objectsInArrays: false
comma-dangle: 0
comma-spacing:
- 2
- after: true
comma-style: 2
camelcase: 0
curly:
- error
- all
dot-notation: 2
eol-last: 2
eqeqeq: 2
func-names:
- error
- never
indent:
- error
- 4
- SwitchCase: 1
MemberExpression: 1
ImportDeclaration: 1
ObjectExpression: 1
react/jsx-curly-spacing:
- error
- always
- allowMultiline: false
- spacing:
- objectLiterals:
- never
- children: true
react/jsx-tag-spacing:
- error
- beforeClosing: never
react/jsx-closing-bracket-location:
- error
- location: after-props
key-spacing: 2
keyword-spacing: 2
linebreak-style:
- error
- unix
max-len:
- 2
- 150
new-cap: 2
no-bitwise: 2
no-caller: 2
no-mixed-spaces-and-tabs: 2
no-multiple-empty-lines:
- error
- max: 1
no-trailing-spaces: 2
no-use-before-define:
- error
- functions: false
no-undef: 2
no-unused-vars:
- 2
- varsIgnorePattern: "^_"
no-var: 2
no-with: 2
object-shorthand: 2
object-curly-spacing:
- error
- always
- objectsInObjects: false
arraysInObjects: false
one-var:
- error
- never
padding-line-between-statements:
- error
- blankLine: always
prev: block-like
next: "*"
quote-props:
- error
- as-needed
quotes:
- error
- single
- allowTemplateLiterals: true
semi:
- error
- always
space-before-blocks: 2
space-in-parens: 2
space-infix-ops: 2
space-unary-ops:
- error
- words: false
nonwords: false
vars-on-top: 2
wrap-iife: 2
yoda:
- error
- never