-
Notifications
You must be signed in to change notification settings - Fork 87
/
require-data-selectors.js
29 lines (24 loc) · 1.05 KB
/
require-data-selectors.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
'use strict'
const rule = require('../../../lib/rules/require-data-selectors')
const RuleTester = require('eslint').RuleTester
const ruleTester = new RuleTester()
const errors = [{ messageId: 'unexpected' }]
const parserOptions = { ecmaVersion: 6 }
ruleTester.run('require-data-selectors', rule, {
valid: [
{ code: 'cy.get(\'[data-cy=submit]\').click()', parserOptions },
{ code: 'cy.get(\'[data-QA=submit]\')', parserOptions },
{ code: 'cy.clock(5000)', parserOptions },
{ code: 'cy.scrollTo(0, 10)', parserOptions },
{ code: 'cy.tick(500)', parserOptions },
{ code: 'cy.get(\`[data-cy=${1}]\`)', parserOptions },
],
invalid: [
{ code: 'cy.get(\'[daedta-cy=submit]\').click()', parserOptions, errors },
{ code: 'cy.get(\'[d-cy=submit]\')', parserOptions, errors },
{ code: 'cy.get(".btn-large").click()', parserOptions, errors },
{ code: 'cy.get(".btn-.large").click()', parserOptions, errors },
{ code: 'cy.get(".a")', parserOptions, errors },
{ code: 'cy.get(\`[daedta-cy=${1}]\`)', parserOptions, errors },
],
})