From 865984116f5cfeec7b2e5a98140329881a710d47 Mon Sep 17 00:00:00 2001 From: Yash Mehrotra Date: Fri, 18 Oct 2024 09:53:07 +0530 Subject: [PATCH] chore: add test for connection trimming --- context/connection_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/context/connection_test.go b/context/connection_test.go index d78335d7..503684c5 100644 --- a/context/connection_test.go +++ b/context/connection_test.go @@ -124,6 +124,24 @@ var _ = ginkgo.Describe("Connection Tests", func() { }, expect: "postgres://the-username:the-password@localhost:5443/mission_control", }, + { + name: "space and newline trimming", + connection: models.Connection{ + URL: ` + + postgres://$(username):$(password)@$(properties.host):$(properties.port)/$(properties.database) + + `, + Username: " the-username", + Password: "the-password ", + Properties: map[string]string{ + "host": "localhost", + "database": "mission_control", + "port": "5443", + }, + }, + expect: "postgres://the-username:the-password@localhost:5443/mission_control", + }, } for _, tc := range testCases {