From 68af5aa320cf082ff1dd2f521d24f6a0e84754b7 Mon Sep 17 00:00:00 2001 From: Ni55aN Date: Thu, 29 Aug 2024 23:00:53 +0300 Subject: [PATCH] test: message new lines --- test/lint/formatter.test.ts | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/test/lint/formatter.test.ts b/test/lint/formatter.test.ts index 661b222..79c7d65 100644 --- a/test/lint/formatter.test.ts +++ b/test/lint/formatter.test.ts @@ -142,4 +142,40 @@ describe('Formatter', () => { } ], expect.any(Object)) }) + + it('normalizes messages by replacing new lines', async () => { + const { format } = mockEslint() + const formatter = new Formatter() + + await formatter.format([ + { + ...result1, + messages: [ + { + ...message1, + message: 'message\na\t\nb \nc' + } + ] + } + ]) + + expect(format).toHaveBeenCalledWith([ + { + ...result1, + messages: [ + { + ...message1, + message: 'message a b c' + } + ], + errorCount: expect.any(Number), + fatalErrorCount: expect.any(Number), + fixableErrorCount: expect.any(Number), + fixableWarningCount: expect.any(Number), + suppressedMessages: expect.any(Array), + usedDeprecatedRules: expect.any(Array), + warningCount: expect.any(Number) + } + ], expect.any(Object)) + }) })