test(server): add tests for updating, deleteing and listing trainings
This commit is contained in:
parent
81c265252f
commit
79632c409a
1 changed files with 29 additions and 28 deletions
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"github.com/shopspring/decimal"
|
"github.com/shopspring/decimal"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
"gitlab.mareshq.com/hq/yggdrasil/internal/money"
|
||||||
"gitlab.mareshq.com/hq/yggdrasil/pkg/training"
|
"gitlab.mareshq.com/hq/yggdrasil/pkg/training"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
|
|
@ -88,26 +89,26 @@ func TestServer(t *testing.T) {
|
||||||
Description: "This is a test training",
|
Description: "This is a test training",
|
||||||
Days: 1,
|
Days: 1,
|
||||||
Pricing: []TrainingPrice{
|
Pricing: []TrainingPrice{
|
||||||
//{
|
{
|
||||||
// Amount: decimal.NewFromInt(200),
|
Amount: "200",
|
||||||
// Currency: "EUR",
|
Currency: "EUR",
|
||||||
// Type: OPEN,
|
Type: OPEN,
|
||||||
//},
|
},
|
||||||
//{
|
{
|
||||||
// Amount: decimal.NewFromInt(1000),
|
Amount: "1000",
|
||||||
// Currency: "EUR",
|
Currency: "EUR",
|
||||||
// Type: CORPORATE,
|
Type: CORPORATE,
|
||||||
//},
|
},
|
||||||
//{
|
{
|
||||||
// Amount: decimal.NewFromInt(4900),
|
Amount: "4900",
|
||||||
// Currency: "CZK",
|
Currency: "CZK",
|
||||||
// Type: OPEN,
|
Type: OPEN,
|
||||||
//},
|
},
|
||||||
//{
|
{
|
||||||
// Amount: decimal.NewFromInt(24000),
|
Amount: "24000",
|
||||||
// Currency: "CZK",
|
Currency: "CZK",
|
||||||
// Type: CORPORATE,
|
Type: CORPORATE,
|
||||||
//},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,7 +121,7 @@ func TestServer(t *testing.T) {
|
||||||
assert.Equal(t, newTraining.Name, resultTraining.Name)
|
assert.Equal(t, newTraining.Name, resultTraining.Name)
|
||||||
assert.Equal(t, newTraining.Description, resultTraining.Description)
|
assert.Equal(t, newTraining.Description, resultTraining.Description)
|
||||||
assert.Equal(t, newTraining.Days, resultTraining.Days)
|
assert.Equal(t, newTraining.Days, resultTraining.Days)
|
||||||
//assert.Equal(t, newTraining.Pricing, resultTraining.Pricing)
|
assert.Equal(t, newTraining.Pricing, resultTraining.Pricing)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Training not found", func(t *testing.T) {
|
t.Run("Training not found", func(t *testing.T) {
|
||||||
|
|
@ -178,11 +179,11 @@ func TestServer(t *testing.T) {
|
||||||
Description: tr.Description,
|
Description: tr.Description,
|
||||||
Days: tr.Days,
|
Days: tr.Days,
|
||||||
Pricing: []TrainingPrice{
|
Pricing: []TrainingPrice{
|
||||||
//{
|
{
|
||||||
// Amount: decimal.NewFromInt(200),
|
Amount: decimal.NewFromInt(200).String(),
|
||||||
// Currency: "EUR",
|
Currency: money.EUR,
|
||||||
// Type: OPEN,
|
Type: OPEN,
|
||||||
//},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Reference in a new issue