Skip to content

Commit

Permalink
Chore: add object option test cases in yield-star-spacing (#12679)
Browse files Browse the repository at this point in the history
  • Loading branch information
yeonjuan authored and btmills committed Dec 20, 2019
1 parent 1713d07 commit 9986d9e
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions tests/lib/rules/yield-star-spacing.js
Expand Up @@ -137,6 +137,24 @@ ruleTester.run("yield-star-spacing", rule, {
{
code: "function *foo(){ var result = yield*foo(); }",
options: ["neither"]
},

// object option
{
code: "function *foo(){ yield* foo; }",
options: [{ before: false, after: true }]
},
{
code: "function *foo(){ yield *foo; }",
options: [{ before: true, after: false }]
},
{
code: "function *foo(){ yield * foo; }",
options: [{ before: true, after: true }]
},
{
code: "function *foo(){ yield*foo; }",
options: [{ before: false, after: false }]
}
],

Expand Down Expand Up @@ -227,6 +245,32 @@ ruleTester.run("yield-star-spacing", rule, {
output: "function *foo(){ yield*foo; }",
options: ["neither"],
errors: [unexpectedBeforeError, unexpectedAfterError]
},

// object option
{
code: "function *foo(){ yield*foo; }",
output: "function *foo(){ yield* foo; }",
options: [{ before: false, after: true }],
errors: [missingAfterError]
},
{
code: "function *foo(){ yield * foo; }",
output: "function *foo(){ yield *foo; }",
options: [{ before: true, after: false }],
errors: [unexpectedAfterError]
},
{
code: "function *foo(){ yield*foo; }",
output: "function *foo(){ yield * foo; }",
options: [{ before: true, after: true }],
errors: [missingBeforeError, missingAfterError]
},
{
code: "function *foo(){ yield * foo; }",
output: "function *foo(){ yield*foo; }",
options: [{ before: false, after: false }],
errors: [unexpectedBeforeError, unexpectedAfterError]
}
]

Expand Down

0 comments on commit 9986d9e

Please sign in to comment.