From 3e00e4a886ced6a6e315eb08674c136b79e83a36 Mon Sep 17 00:00:00 2001 From: yeonjuan Date: Tue, 17 Dec 2019 23:58:27 +0900 Subject: [PATCH] Chore: add object option test cases in yield-star-spacing --- 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] } ]