Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions call-profile/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ func TestHandlerIntegration(t *testing.T) {
"githubId": "johndoe",
"linkedin": "johndoe",
"website": "https://johndoe.com",
"dob": "1990-01-15",
},
mockServer: func() *httptest.Server {
return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
Expand All @@ -337,7 +338,8 @@ func TestHandlerIntegration(t *testing.T) {
"designation": "Developer",
"github_id": "johndoe",
"linkedin_id": "johndoe",
"website": "https://johndoe.com"
"website": "https://johndoe.com",
"dob": "1990-01-15"
}`))
}
}))
Expand Down Expand Up @@ -522,6 +524,7 @@ func TestHandlerWithRealFirestore(t *testing.T) {
"githubId": "integrationtest",
"linkedin": "integrationtest",
"website": "https://integrationtest.com",
"dob": "1992-05-20",
}

server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
Expand All @@ -540,7 +543,8 @@ func TestHandlerWithRealFirestore(t *testing.T) {
"designation": "Tester",
"github_id": "integrationtest",
"linkedin_id": "integrationtest",
"website": "https://integrationtest.com"
"website": "https://integrationtest.com",
"dob": "1992-05-20"
}`))
}
}))
Expand Down
2 changes: 2 additions & 0 deletions call-profile/testdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ var ResValidationTests = []struct {
TwitterId: "johndoe",
InstagramId: "johndoe",
Website: "https://johndoe.com",
DOB: "1990-01-15",
},
IsValid: true,
Description: "Complete valid Res struct",
Expand Down Expand Up @@ -293,3 +294,4 @@ var EmptyUserIdTests = []struct {
Description: "Null userId should return skip message",
},
}

3 changes: 3 additions & 0 deletions layer/utils/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type Res struct {
TwitterId string `json:"twitter_id"`
InstagramId string `json:"instagram_id"`
Website string `json:"website"`
DOB string `json:"dob"`
}

type Diff struct {
Expand All @@ -46,6 +47,7 @@ type Diff struct {
TwitterId string `firestore:"twitter_id,omitempty"`
InstagramId string `firestore:"instagram_id,omitempty"`
Website string `firestore:"website,omitempty"`
DOB string `firestore:"dob,omitempty"`
}

type Claims struct {
Expand Down Expand Up @@ -99,5 +101,6 @@ func diffToMap(diff Diff) map[string]interface{} {
"twitter_id": diff.TwitterId,
"instagram_id": diff.InstagramId,
"website": diff.Website,
"dob": diff.DOB,
}
}
2 changes: 2 additions & 0 deletions layer/utils/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func resToDiff(res Res, userId string) Diff {
TwitterId: res.TwitterId,
InstagramId: res.InstagramId,
Website: res.Website,
DOB: res.DOB,
}
}

Expand All @@ -43,6 +44,7 @@ func DiffToRes(diff Diff) Res {
TwitterId: diff.TwitterId,
InstagramId: diff.InstagramId,
Website: diff.Website,
DOB: diff.DOB,
}
}

Expand Down