@@ -180,6 +180,50 @@ func TestParseFile(t *testing.T) {
180180 }
181181}
182182
183+ func TestReferenceUrlParsing (t * testing.T ) {
184+ t .Run ("Should parse Reference with Url and SocialNetworks fields" , func (t * testing.T ) {
185+ yamlContent := []byte (`
186+ references:
187+ - name: Jane Doe
188+ position: CTO
189+ company: TechCorp
190+ date: Jan 2024
191+ url: https://linkedin.com/in/janedoe
192+ socialNetworks:
193+ linkedin: janedoe
194+ github: janedoe-gh
195+ description: "Great engineer!"
196+ ` )
197+ p := & ParserServices {}
198+ got := p .convertFileContentToStruct (yamlContent )
199+
200+ assert .Len (t , got .References , 1 )
201+ assert .Equal (t , "Jane Doe" , got .References [0 ].Name )
202+ assert .Equal (t , "https://linkedin.com/in/janedoe" , got .References [0 ].Url )
203+ assert .Equal (t , "Great engineer!" , got .References [0 ].Description )
204+ assert .Equal (t , "janedoe" , got .References [0 ].SocialNetworks .Linkedin )
205+ assert .Equal (t , "janedoe-gh" , got .References [0 ].SocialNetworks .Github )
206+ })
207+
208+ t .Run ("Should parse Reference without Url field" , func (t * testing.T ) {
209+ yamlContent := []byte (`
210+ references:
211+ - name: John Smith
212+ position: Developer
213+ company: WebCorp
214+ date: Dec 2023
215+ description: "Talented developer"
216+ ` )
217+ p := & ParserServices {}
218+ got := p .convertFileContentToStruct (yamlContent )
219+
220+ assert .Len (t , got .References , 1 )
221+ assert .Equal (t , "John Smith" , got .References [0 ].Name )
222+ assert .Equal (t , "" , got .References [0 ].Url )
223+ assert .Equal (t , "Talented developer" , got .References [0 ].Description )
224+ })
225+ }
226+
183227func TestReadFile (t * testing.T ) {
184228 testDirectory , _ := os .Getwd ()
185229 baseDirectory , err := filepath .Abs (testDirectory + "/../.." )
0 commit comments