From 9986d9e0baed0d3586bbee472fe2fae2ed625f5d Mon Sep 17 00:00:00 2001 From: YeonJuan Date: Sat, 21 Dec 2019 05:45:25 +0900 Subject: [PATCH] Chore: add object option test cases in yield-star-spacing (#12679) --- tests/lib/rules/yield-star-spacing.js | 44 +++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/tests/lib/rules/yield-star-spacing.js b/tests/lib/rules/yield-star-spacing.js index 0665f648e52..9c8aaff952e 100644 --- a/tests/lib/rules/yield-star-spacing.js +++ b/tests/lib/rules/yield-star-spacing.js @@ -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 }] } ], @@ -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] } ]