refactor(training): use golang style of naming (do not repeat pacakge name in struct/func names)
This commit is contained in:
parent
e0f401f0a9
commit
c3795dba6a
12 changed files with 232 additions and 232 deletions
|
|
@ -80,8 +80,8 @@ func doDelete(t *testing.T, app *fiber.App, rawURL string) (*http.Response, erro
|
|||
func TestServer(t *testing.T) {
|
||||
//var err error
|
||||
trainingRepo := training.NewInMemoryTrainingRepository()
|
||||
trainingDateRepo := training.NewInMemoryTrainingDateRepository()
|
||||
trainingDateAttendeeRepo := training.NewInMemoryTrainingDateAttendeeRepository()
|
||||
trainingDateRepo := training.NewInMemoryDateRepository()
|
||||
trainingDateAttendeeRepo := training.NewInMemoryAttendeeRepository()
|
||||
|
||||
handlers := NewAPIHandlers(trainingRepo, trainingDateRepo, trainingDateAttendeeRepo)
|
||||
app := NewTestingServer(handlers)
|
||||
|
|
@ -142,7 +142,7 @@ func TestServer(t *testing.T) {
|
|||
Name: "Testing Training",
|
||||
Description: "This is a test training",
|
||||
Days: 1,
|
||||
Pricing: []training.TrainingPrice{
|
||||
Pricing: []training.Price{
|
||||
{
|
||||
Amount: decimal.NewFromInt(200),
|
||||
Currency: "EUR",
|
||||
|
|
@ -166,7 +166,7 @@ func TestServer(t *testing.T) {
|
|||
Name: "Testing Training",
|
||||
Description: "This is a test training",
|
||||
Days: 1,
|
||||
Pricing: []training.TrainingPrice{
|
||||
Pricing: []training.Price{
|
||||
{
|
||||
Amount: decimal.NewFromInt(200),
|
||||
Currency: "EUR",
|
||||
|
|
@ -204,7 +204,7 @@ func TestServer(t *testing.T) {
|
|||
Name: "Testing Training",
|
||||
Description: "This is a test training",
|
||||
Days: 1,
|
||||
Pricing: []training.TrainingPrice{
|
||||
Pricing: []training.Price{
|
||||
{
|
||||
Amount: decimal.NewFromInt(200),
|
||||
Currency: "EUR",
|
||||
|
|
@ -243,7 +243,7 @@ func TestServer(t *testing.T) {
|
|||
Name: "Testing Training for training date",
|
||||
Description: "This is a test training for training date",
|
||||
Days: 1,
|
||||
Pricing: []training.TrainingPrice{
|
||||
Pricing: []training.Price{
|
||||
{
|
||||
Amount: decimal.NewFromInt(200),
|
||||
Currency: "EUR",
|
||||
|
|
@ -293,7 +293,7 @@ func TestServer(t *testing.T) {
|
|||
Name: "Testing Training for training date",
|
||||
Description: "This is a test training for training date",
|
||||
Days: 1,
|
||||
Pricing: []training.TrainingPrice{
|
||||
Pricing: []training.Price{
|
||||
{
|
||||
Amount: decimal.NewFromInt(200),
|
||||
Currency: "EUR",
|
||||
|
|
@ -318,7 +318,7 @@ func TestServer(t *testing.T) {
|
|||
Name: "Testing Training for training date",
|
||||
Description: "This is a test training for training date",
|
||||
Days: 1,
|
||||
Pricing: []training.TrainingPrice{
|
||||
Pricing: []training.Price{
|
||||
{
|
||||
Amount: decimal.NewFromInt(200),
|
||||
Currency: "EUR",
|
||||
|
|
@ -330,7 +330,7 @@ func TestServer(t *testing.T) {
|
|||
|
||||
date := time.Date(2024, time.May, 1, 0, 0, 0, 0, time.UTC)
|
||||
|
||||
td := &training.TrainingDate{
|
||||
td := &training.Date{
|
||||
Address: "Test Address 123, NYC",
|
||||
Capacity: 12,
|
||||
Date: date,
|
||||
|
|
@ -362,7 +362,7 @@ func TestServer(t *testing.T) {
|
|||
Name: "Testing Training for training date",
|
||||
Description: "This is a test training for training date",
|
||||
Days: 1,
|
||||
Pricing: []training.TrainingPrice{
|
||||
Pricing: []training.Price{
|
||||
{
|
||||
Amount: decimal.NewFromInt(200),
|
||||
Currency: "EUR",
|
||||
|
|
@ -374,7 +374,7 @@ func TestServer(t *testing.T) {
|
|||
|
||||
date := time.Date(2024, time.May, 1, 0, 0, 0, 0, time.UTC)
|
||||
|
||||
td := &training.TrainingDate{
|
||||
td := &training.Date{
|
||||
Address: "Test Address 123, NYC",
|
||||
Capacity: 12,
|
||||
Date: date,
|
||||
|
|
@ -423,7 +423,7 @@ func TestServer(t *testing.T) {
|
|||
Name: "Testing Training for training date",
|
||||
Description: "This is a test training for training date",
|
||||
Days: 1,
|
||||
Pricing: []training.TrainingPrice{
|
||||
Pricing: []training.Price{
|
||||
{
|
||||
Amount: decimal.NewFromInt(200),
|
||||
Currency: "EUR",
|
||||
|
|
@ -435,7 +435,7 @@ func TestServer(t *testing.T) {
|
|||
|
||||
date := time.Date(2024, time.May, 1, 0, 0, 0, 0, time.UTC)
|
||||
|
||||
td := &training.TrainingDate{
|
||||
td := &training.Date{
|
||||
Address: "Test Address 123, NYC",
|
||||
Capacity: 12,
|
||||
Date: date,
|
||||
|
|
@ -482,7 +482,7 @@ func TestServer(t *testing.T) {
|
|||
Name: "Testing Training for training date",
|
||||
Description: "This is a test training for training date",
|
||||
Days: 1,
|
||||
Pricing: []training.TrainingPrice{
|
||||
Pricing: []training.Price{
|
||||
{
|
||||
Amount: decimal.NewFromInt(200),
|
||||
Currency: "EUR",
|
||||
|
|
@ -496,7 +496,7 @@ func TestServer(t *testing.T) {
|
|||
upcomingTrainingCount := 5
|
||||
for i := -4; i <= 5; i++ {
|
||||
date := now.AddDate(0, 0, i)
|
||||
td := &training.TrainingDate{
|
||||
td := &training.Date{
|
||||
Address: "Test Address 123, NYC",
|
||||
Capacity: 12,
|
||||
Date: date,
|
||||
|
|
@ -524,7 +524,7 @@ func TestServer(t *testing.T) {
|
|||
Name: "Testing Training for training date 1",
|
||||
Description: "This is a test training for training date",
|
||||
Days: 1,
|
||||
Pricing: []training.TrainingPrice{
|
||||
Pricing: []training.Price{
|
||||
{
|
||||
Amount: decimal.NewFromInt(200),
|
||||
Currency: "EUR",
|
||||
|
|
@ -538,7 +538,7 @@ func TestServer(t *testing.T) {
|
|||
Name: "Testing Training for training date 2",
|
||||
Description: "This is a test training for training date",
|
||||
Days: 1,
|
||||
Pricing: []training.TrainingPrice{
|
||||
Pricing: []training.Price{
|
||||
{
|
||||
Amount: decimal.NewFromInt(200),
|
||||
Currency: "EUR",
|
||||
|
|
@ -552,7 +552,7 @@ func TestServer(t *testing.T) {
|
|||
Name: "Testing Training for training date 3",
|
||||
Description: "This is a test training for training date",
|
||||
Days: 1,
|
||||
Pricing: []training.TrainingPrice{
|
||||
Pricing: []training.Price{
|
||||
{
|
||||
Amount: decimal.NewFromInt(200),
|
||||
Currency: "EUR",
|
||||
|
|
@ -568,7 +568,7 @@ func TestServer(t *testing.T) {
|
|||
upcomingTrainingCount := 5
|
||||
for i := -4; i <= upcomingTrainingCount; i++ {
|
||||
date := now.AddDate(0, 0, i)
|
||||
td1 := &training.TrainingDate{
|
||||
td1 := &training.Date{
|
||||
Address: "Test Address 123, NYC",
|
||||
Capacity: 12,
|
||||
Date: date,
|
||||
|
|
@ -581,7 +581,7 @@ func TestServer(t *testing.T) {
|
|||
}
|
||||
_ = handlers.trainingDateRepository.Create(tr1.ID, td1)
|
||||
|
||||
td2 := &training.TrainingDate{
|
||||
td2 := &training.Date{
|
||||
Address: "Test Address 123, NYC",
|
||||
Capacity: 12,
|
||||
Date: date,
|
||||
|
|
@ -594,7 +594,7 @@ func TestServer(t *testing.T) {
|
|||
}
|
||||
_ = handlers.trainingDateRepository.Create(tr2.ID, td2)
|
||||
|
||||
td3 := &training.TrainingDate{
|
||||
td3 := &training.Date{
|
||||
Address: "Test Address 123, NYC",
|
||||
Capacity: 12,
|
||||
Date: date,
|
||||
|
|
@ -628,7 +628,7 @@ func TestServer(t *testing.T) {
|
|||
Name: "Testing Training for training date",
|
||||
Description: "This is a test training for training date",
|
||||
Days: 1,
|
||||
Pricing: []training.TrainingPrice{
|
||||
Pricing: []training.Price{
|
||||
{
|
||||
Amount: decimal.NewFromInt(200),
|
||||
Currency: "EUR",
|
||||
|
|
@ -641,7 +641,7 @@ func TestServer(t *testing.T) {
|
|||
|
||||
date := time.Date(2024, time.May, 1, 9, 0, 0, 0, time.UTC)
|
||||
|
||||
td := &training.TrainingDate{
|
||||
td := &training.Date{
|
||||
Address: "Test Address 123, NYC",
|
||||
Capacity: 12,
|
||||
Date: date,
|
||||
|
|
@ -668,7 +668,7 @@ func TestServer(t *testing.T) {
|
|||
Name: "Testing Training for training date",
|
||||
Description: "This is a test training for training date",
|
||||
Days: 1,
|
||||
Pricing: []training.TrainingPrice{
|
||||
Pricing: []training.Price{
|
||||
{
|
||||
Amount: decimal.NewFromInt(200),
|
||||
Currency: "EUR",
|
||||
|
|
@ -681,7 +681,7 @@ func TestServer(t *testing.T) {
|
|||
|
||||
date := time.Date(2024, time.May, 1, 9, 0, 0, 0, time.UTC)
|
||||
|
||||
td := &training.TrainingDate{
|
||||
td := &training.Date{
|
||||
Address: "Test Address 123, NYC",
|
||||
Capacity: 12,
|
||||
Date: date,
|
||||
|
|
@ -726,7 +726,7 @@ func TestServer(t *testing.T) {
|
|||
Name: "Testing Training for training date",
|
||||
Description: "This is a test training for training date",
|
||||
Days: 1,
|
||||
Pricing: []training.TrainingPrice{
|
||||
Pricing: []training.Price{
|
||||
{
|
||||
Amount: decimal.NewFromInt(200),
|
||||
Currency: "EUR",
|
||||
|
|
@ -739,7 +739,7 @@ func TestServer(t *testing.T) {
|
|||
|
||||
date := time.Date(2024, time.May, 1, 9, 0, 0, 0, time.UTC)
|
||||
|
||||
td := &training.TrainingDate{
|
||||
td := &training.Date{
|
||||
Address: "Test Address 123, NYC",
|
||||
Capacity: 12,
|
||||
Date: date,
|
||||
|
|
@ -753,9 +753,9 @@ func TestServer(t *testing.T) {
|
|||
_ = handlers.trainingDateRepository.Create(tr.ID, td)
|
||||
|
||||
attendeeCount := 9
|
||||
attendees := make([]training.TrainingDateAttendee, attendeeCount)
|
||||
attendees := make([]training.Attendee, attendeeCount)
|
||||
for i := range attendeeCount {
|
||||
nAtd := &training.TrainingDateAttendee{
|
||||
nAtd := &training.Attendee{
|
||||
Name: "John Doe",
|
||||
Email: "john.doe@example.com",
|
||||
Company: "Acme Inc.",
|
||||
|
|
@ -799,7 +799,7 @@ func TestServer(t *testing.T) {
|
|||
Name: "Testing Training for training date",
|
||||
Description: "This is a test training for training date",
|
||||
Days: 1,
|
||||
Pricing: []training.TrainingPrice{
|
||||
Pricing: []training.Price{
|
||||
{
|
||||
Amount: decimal.NewFromInt(200),
|
||||
Currency: "EUR",
|
||||
|
|
@ -812,7 +812,7 @@ func TestServer(t *testing.T) {
|
|||
|
||||
date := time.Date(2024, time.May, 1, 9, 0, 0, 0, time.UTC)
|
||||
|
||||
td := &training.TrainingDate{
|
||||
td := &training.Date{
|
||||
Address: "Test Address 123, NYC",
|
||||
Capacity: 12,
|
||||
Date: date,
|
||||
|
|
@ -825,7 +825,7 @@ func TestServer(t *testing.T) {
|
|||
}
|
||||
_ = handlers.trainingDateRepository.Create(tr.ID, td)
|
||||
|
||||
attendee := &training.TrainingDateAttendee{
|
||||
attendee := &training.Attendee{
|
||||
Name: "John Doe",
|
||||
Email: "john.doe@example.com",
|
||||
Company: "Acme Inc.",
|
||||
|
|
@ -862,7 +862,7 @@ func TestServer(t *testing.T) {
|
|||
Name: "Testing Training for training date",
|
||||
Description: "This is a test training for training date",
|
||||
Days: 1,
|
||||
Pricing: []training.TrainingPrice{
|
||||
Pricing: []training.Price{
|
||||
{
|
||||
Amount: decimal.NewFromInt(200),
|
||||
Currency: "EUR",
|
||||
|
|
@ -875,7 +875,7 @@ func TestServer(t *testing.T) {
|
|||
|
||||
date := time.Date(2024, time.May, 1, 9, 0, 0, 0, time.UTC)
|
||||
|
||||
td := &training.TrainingDate{
|
||||
td := &training.Date{
|
||||
Address: "Test Address 123, NYC",
|
||||
Capacity: 12,
|
||||
Date: date,
|
||||
|
|
@ -888,7 +888,7 @@ func TestServer(t *testing.T) {
|
|||
}
|
||||
_ = handlers.trainingDateRepository.Create(tr.ID, td)
|
||||
|
||||
attendee := &training.TrainingDateAttendee{
|
||||
attendee := &training.Attendee{
|
||||
Name: "John Doe",
|
||||
Email: "john.doe@example.com",
|
||||
Company: "Acme Inc.",
|
||||
|
|
@ -935,7 +935,7 @@ func TestServer(t *testing.T) {
|
|||
Name: "Testing Training for training date",
|
||||
Description: "This is a test training for training date",
|
||||
Days: 1,
|
||||
Pricing: []training.TrainingPrice{
|
||||
Pricing: []training.Price{
|
||||
{
|
||||
Amount: decimal.NewFromInt(200),
|
||||
Currency: "EUR",
|
||||
|
|
@ -948,7 +948,7 @@ func TestServer(t *testing.T) {
|
|||
|
||||
date := time.Date(2024, time.May, 1, 9, 0, 0, 0, time.UTC)
|
||||
|
||||
td := &training.TrainingDate{
|
||||
td := &training.Date{
|
||||
Address: "Test Address 123, NYC",
|
||||
Capacity: 12,
|
||||
Date: date,
|
||||
|
|
@ -961,7 +961,7 @@ func TestServer(t *testing.T) {
|
|||
}
|
||||
_ = handlers.trainingDateRepository.Create(tr.ID, td)
|
||||
|
||||
attendee := &training.TrainingDateAttendee{
|
||||
attendee := &training.Attendee{
|
||||
Name: "John Doe",
|
||||
Email: "john.doe@example.com",
|
||||
Company: "Acme Inc.",
|
||||
|
|
@ -991,7 +991,7 @@ func TestServer(t *testing.T) {
|
|||
Name: "Testing Training for training date",
|
||||
Description: "This is a test training for training date",
|
||||
Days: 1,
|
||||
Pricing: []training.TrainingPrice{
|
||||
Pricing: []training.Price{
|
||||
{
|
||||
Amount: decimal.NewFromInt(200),
|
||||
Currency: "EUR",
|
||||
|
|
@ -1004,7 +1004,7 @@ func TestServer(t *testing.T) {
|
|||
|
||||
date := time.Date(2024, time.May, 1, 9, 0, 0, 0, time.UTC)
|
||||
|
||||
td := &training.TrainingDate{
|
||||
td := &training.Date{
|
||||
Address: "Test Address 123, NYC",
|
||||
Capacity: 12,
|
||||
Date: date,
|
||||
|
|
@ -1021,7 +1021,7 @@ func TestServer(t *testing.T) {
|
|||
Paid: true,
|
||||
}
|
||||
|
||||
attendee := &training.TrainingDateAttendee{
|
||||
attendee := &training.Attendee{
|
||||
Name: "John Doe",
|
||||
Email: "john.doe@example.com",
|
||||
Company: "Acme Inc.",
|
||||
|
|
@ -1064,7 +1064,7 @@ func TestServer(t *testing.T) {
|
|||
Name: "Testing Training for training date",
|
||||
Description: "This is a test training for training date",
|
||||
Days: 1,
|
||||
Pricing: []training.TrainingPrice{
|
||||
Pricing: []training.Price{
|
||||
{
|
||||
Amount: decimal.NewFromInt(200),
|
||||
Currency: "EUR",
|
||||
|
|
@ -1077,7 +1077,7 @@ func TestServer(t *testing.T) {
|
|||
|
||||
date := time.Date(2024, time.May, 1, 9, 0, 0, 0, time.UTC)
|
||||
|
||||
td := &training.TrainingDate{
|
||||
td := &training.Date{
|
||||
Address: "Test Address 123, NYC",
|
||||
Capacity: 12,
|
||||
Date: date,
|
||||
|
|
@ -1094,7 +1094,7 @@ func TestServer(t *testing.T) {
|
|||
Attended: true,
|
||||
}
|
||||
|
||||
attendee := &training.TrainingDateAttendee{
|
||||
attendee := &training.Attendee{
|
||||
Name: "John Doe",
|
||||
Email: "john.doe@example.com",
|
||||
Company: "Acme Inc.",
|
||||
|
|
@ -1137,7 +1137,7 @@ func TestServer(t *testing.T) {
|
|||
Name: "Testing Training for training date",
|
||||
Description: "This is a test training for training date",
|
||||
Days: 1,
|
||||
Pricing: []training.TrainingPrice{
|
||||
Pricing: []training.Price{
|
||||
{
|
||||
Amount: decimal.NewFromInt(200),
|
||||
Currency: "EUR",
|
||||
|
|
@ -1150,7 +1150,7 @@ func TestServer(t *testing.T) {
|
|||
|
||||
date := time.Date(2024, time.May, 1, 9, 0, 0, 0, time.UTC)
|
||||
|
||||
td := &training.TrainingDate{
|
||||
td := &training.Date{
|
||||
Address: "Test Address 123, NYC",
|
||||
Capacity: 12,
|
||||
Date: date,
|
||||
|
|
@ -1165,7 +1165,7 @@ func TestServer(t *testing.T) {
|
|||
|
||||
attendeeCount := 9
|
||||
for range attendeeCount {
|
||||
nAtd := &training.TrainingDateAttendee{
|
||||
nAtd := &training.Attendee{
|
||||
Name: "John Doe",
|
||||
Email: "john.doe@example.com",
|
||||
Company: "Acme Inc.",
|
||||
|
|
|
|||
Reference in a new issue