From ca6e48b19bdab909d8a30b2d3e510f1bdf3d9fbd Mon Sep 17 00:00:00 2001 From: mizdra Date: Sat, 28 Sep 2024 14:13:18 +0900 Subject: [PATCH] improve test cases --- src/fix/disable-per-line.test.ts | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/fix/disable-per-line.test.ts b/src/fix/disable-per-line.test.ts index 406c9dce..1de989c4 100644 --- a/src/fix/disable-per-line.test.ts +++ b/src/fix/disable-per-line.test.ts @@ -144,8 +144,19 @@ describe('disable-per-line', () => { expect( await tester.test({ code: [ - 'const foo = `', - ' This is a template literal', + '`', + // eslint-disable-next-line no-template-curly-in-string + '${void 1}', + // eslint-disable-next-line no-template-curly-in-string + '${0 + void 1}', + '${', + 'void 1', + '}', + // eslint-disable-next-line no-template-curly-in-string + '${`${void 1}`}', + '`;', + // MEMO: Code that includes indents can be fixed, but it will not be formatted prettily. This is a limitation of eslint-interactive. + 'const withIndent = `', // eslint-disable-next-line no-template-curly-in-string ' ${void 1}', '`;', @@ -153,8 +164,19 @@ describe('disable-per-line', () => { rules: { 'no-void': 'error' }, }), ).toMatchInlineSnapshot(` - "const foo = \` - This is a template literal + "\` + \${// eslint-disable-next-line no-void + void 1} + \${// eslint-disable-next-line no-void + 0 + void 1} + \${ + // eslint-disable-next-line no-void + void 1 + } + \${\`\${// eslint-disable-next-line no-void + void 1}\`} + \`; + const withIndent = \` \${ // eslint-disable-next-line no-void void 1} \`;"