-
Notifications
You must be signed in to change notification settings - Fork 91
/
Copy pathunsafe-to-chain-command.js
34 lines (29 loc) · 1.12 KB
/
unsafe-to-chain-command.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
30
31
32
33
34
'use strict'
const rule = require('../../../lib/rules/unsafe-to-chain-command')
const RuleTester = require('eslint').RuleTester
const ruleTester = new RuleTester()
const errors = [{ messageId: 'unexpected' }]
ruleTester.run('action-ends-chain', rule, {
valid: [
{
code: 'cy.get("new-todo").type("todo A{enter}"); cy.get("new-todo").type("todo B{enter}"); cy.get("new-todo").should("have.class", "active");'
},
{ code: 'cy.focused().should("be.visible");' },
{ code: 'cy.submitBtn().click();' },
],
invalid: [
{ code: 'cy.get("new-todo").type("todo A{enter}").should("have.class", "active");', errors },
{ code: 'cy.get("new-todo").type("todo A{enter}").type("todo B{enter}");', errors },
{ code: 'cy.get("new-todo").focus().should("have.class", "active");', errors },
{
code: 'cy.get("new-todo").customType("todo A{enter}").customClick();',
options: [{ methods: ['customType', 'customClick'] }],
errors,
},
{
code: 'cy.get("new-todo").customPress("Enter").customScroll();',
options: [{ methods: ['customPress', 'customScroll'] }],
errors,
},
],
})