Conditions | 5 |
Total Lines | 20 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | package utils |
||
18 | func TestGetAllInformation(t *testing.T) { |
||
19 | t.Run("returns slice with PhotoReport models", func(t *testing.T) { |
||
20 | links := []string{FileGetContents("../storage/test_files/item")} |
||
21 | |||
22 | title := "Title here" |
||
23 | img := "https://image.jpg" |
||
24 | url := "https://test.com/hello/" |
||
25 | |||
26 | result := GetAllInformation(&links) |
||
27 | |||
28 | if result[0].Title != title { |
||
29 | t.Error("Returned Title from GetAllInformation func must be `" + title + "` but `" + result[0].Title + "` returned") |
||
30 | } |
||
31 | |||
32 | if result[0].Image != img { |
||
33 | t.Error("Returned Image from GetAllInformation func must be `" + img + "` but `" + result[0].Image + "` returned") |
||
34 | } |
||
35 | |||
36 | if result[0].URL != url { |
||
37 | t.Error("Returned URL from GetAllInformation func must be `" + url + "` but `" + result[0].URL + "` returned") |
||
38 | } |
||
50 |