From eb1d295e0bc95853b0ddb20dddd0a3d365803721 Mon Sep 17 00:00:00 2001 From: Sergio Padrino Date: Wed, 13 Mar 2024 13:52:30 +0100 Subject: [PATCH] Use parseBadConfigValueErrorInfo in tests --- test/fast/errors-test.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/test/fast/errors-test.ts b/test/fast/errors-test.ts index b4e6a40..eeca612 100644 --- a/test/fast/errors-test.ts +++ b/test/fast/errors-test.ts @@ -82,15 +82,10 @@ describe('detects errors', () => { expect(result).toHaveGitError(GitError.BadConfigValue) - const errorEntry = Object.entries(GitErrorRegexes).find( - ([_, v]) => v === GitError.BadConfigValue - ) - - expect(errorEntry).not.toBe(null) - const m = result.stderr.match(errorEntry![0]) - - expect(m![1]).toBe('nab') - expect(m![2]).toBe('core.autocrlf') + const errorInfo = GitProcess.parseBadConfigValueErrorInfo(result.stderr) + expect(errorInfo).not.toBe(null) + expect(errorInfo!.value).toBe('nab') + expect(errorInfo!.key).toBe('core.autocrlf') }) it('detects bad numeric config value', async () => { const repoPath = await initialize('bad-config-repo')