@@ -91,7 +91,7 @@ func TestSimilarsFunc(t *testing.T) {
9191 requestPath : "/v1/similars/alice/test1/https%3A%2F%2Fid.salamanca.school%2Ftexts%2FW0001%3Avol1.1.1.1.1" ,
9292 bodyPath : "" ,
9393 apiKey : aliceAPIKey ,
94- expectBody : "" , // Will validate structure programmatically
94+ expectBody : "" , // Will validate structure programmatically
9595 expectStatus : http .StatusOK ,
9696 },
9797 {
@@ -100,7 +100,7 @@ func TestSimilarsFunc(t *testing.T) {
100100 requestPath : "/v1/similars/alice/test1/https%3A%2F%2Fid.salamanca.school%2Ftexts%2FW0001%3Avol1.1.1.1.1?metadata_path=author&metadata_value=Immanuel%20Kant" ,
101101 bodyPath : "" ,
102102 apiKey : options .AdminKey ,
103- expectBody : "" , // Will validate structure programmatically
103+ expectBody : "" , // Will validate structure programmatically
104104 expectStatus : http .StatusOK ,
105105 },
106106 }
@@ -145,14 +145,14 @@ func TestSimilarsFunc(t *testing.T) {
145145
146146 respBody , err := io .ReadAll (resp .Body ) // response body is []byte
147147 assert .NoError (t , err )
148-
148+
149149 // Parse and validate JSON structure
150150 if v .expectBody == "" && resp .StatusCode == http .StatusOK {
151151 // Validate that response has correct structure with results array
152152 var result map [string ]interface {}
153153 err = json .Unmarshal (respBody , & result )
154154 assert .NoError (t , err )
155-
155+
156156 // Check results field exists and is an array
157157 results , ok := result ["results" ].([]interface {})
158158 if ! ok {
@@ -212,7 +212,7 @@ func TestSimilarsFunc(t *testing.T) {
212212 shutDownServer ()
213213 })
214214
215- fmt .Printf ("\n \n \n \n " )
215+ fmt .Printf ("\n " )
216216}
217217
218218// TestPostSimilar tests the POST similar functionality.
@@ -296,11 +296,11 @@ func TestPostSimilar(t *testing.T) {
296296 expectError bool
297297 }{
298298 {
299- name : "POST similar with valid 5D vector" ,
300- method : http .MethodPost ,
301- requestPath : "/v1/similars/alice/test1" ,
302- body : `{"vector": [-0.02085085, 0.01852216, 0.05327000, 0.07138438, 0.02000308]}` ,
303- apiKey : aliceAPIKey ,
299+ name : "POST similar with valid 5D vector" ,
300+ method : http .MethodPost ,
301+ requestPath : "/v1/similars/alice/test1" ,
302+ body : `{"vector": [-0.02085085, 0.01852216, 0.05327000, 0.07138438, 0.02000308]}` ,
303+ apiKey : aliceAPIKey ,
304304 expectStatus : http .StatusOK ,
305305 expectIDs : []string {
306306 "https%3A%2F%2Fid.salamanca.school%2Ftexts%2FW0001%3Avol1.1.1.1.1" ,
@@ -310,11 +310,11 @@ func TestPostSimilar(t *testing.T) {
310310 expectError : false ,
311311 },
312312 {
313- name : "POST similar with valid 5D vector and metadata filter" ,
314- method : http .MethodPost ,
315- requestPath : "/v1/similars/alice/test1?metadata_path=author&metadata_value=Immanuel%20Kant" ,
316- body : `{"vector": [-0.02085085, 0.01852216, 0.05327000, 0.07138438, 0.02000308]}` ,
317- apiKey : aliceAPIKey ,
313+ name : "POST similar with valid 5D vector and metadata filter" ,
314+ method : http .MethodPost ,
315+ requestPath : "/v1/similars/alice/test1?metadata_path=author&metadata_value=Immanuel%20Kant" ,
316+ body : `{"vector": [-0.02085085, 0.01852216, 0.05327000, 0.07138438, 0.02000308]}` ,
317+ apiKey : aliceAPIKey ,
318318 expectStatus : http .StatusOK ,
319319 expectIDs : []string {
320320 "https%3A%2F%2Fid.salamanca.school%2Ftexts%2FW0001%3Avol2" ,
@@ -425,7 +425,7 @@ func TestPostSimilar(t *testing.T) {
425425 continue
426426 }
427427 actualIDs [i ] = id .(string )
428-
428+
429429 // Verify similarity field exists and is a number
430430 similarity , hasSim := resultItem ["similarity" ]
431431 if ! hasSim {
@@ -434,7 +434,7 @@ func TestPostSimilar(t *testing.T) {
434434 t .Errorf ("Result item %d 'similarity' is not a number" , i )
435435 }
436436 }
437-
437+
438438 // Check that all expected IDs are present (order doesn't matter for similar items)
439439 for _ , expectedID := range v .expectIDs {
440440 found := false
@@ -474,5 +474,5 @@ func TestPostSimilar(t *testing.T) {
474474 shutDownServer ()
475475 })
476476
477- fmt .Printf ("\n \n \n \n " )
477+ fmt .Printf ("\n " )
478478}
0 commit comments