/
server_test.go
48 lines (43 loc) · 1.33 KB
/
server_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package main
import (
"bytes"
"fmt"
"testing"
"time"
)
func TestTormHandler(t *testing.T) {
profile1 := &Profile{
Name: "John Wick",
Position: "CEO",
Address: "New York City, USA",
Phone: "+601234567",
EmailAddress: "john.wick@mail.com",
PersonalWebsite: "https://johnwick.com",
URLToImage: "",
About: "Profile of John Wick, CEO of Heaven and Earth Corp.",
Skills: []Skills{
{Skill: "HTML", Rating: 100},
{Skill: "Go", Rating: 75},
{Skill: "Angular", Rating: 60},
},
Socials: []Socials{
{Social: "Facebook", Link: "https://facebook.com/johnwick"},
{Social: "Twitter", Link: "https://twitter.com/johnwick"},
},
Experiences: []Experiences{
{YearFrom: 2000, YearTo: 2010, Company: "NCR Corporation", Role: "CEO", Description: "Performed leadership and management"},
{YearFrom: 2010, YearTo: 2020, Company: "IBM Corporation", Role: "CEO", Description: "Performed leadership and management"},
},
Hobbies: []Hobbies{
{Name: "Swimming", Details: "Competitive swimming", Awards: "Olympic Medalist"},
{Name: "Badminton", Details: "Leisure sports", Awards: "Company wide champion"},
},
PublishedAt: time.Now(),
}
buf := &bytes.Buffer{}
err := tpl.Execute(buf, profile1)
if err != nil {
// handle error
fmt.Printf("TEST: Error occurred")
}
}