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/shopspring/decimal"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"gitlab.mareshq.com/hq/yggdrasil/internal/money"
|
||||
"gitlab.mareshq.com/hq/yggdrasil/pkg/training"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
|
@ -88,26 +89,26 @@ func TestServer(t *testing.T) {
|
|||
Description: "This is a test training",
|
||||
Days: 1,
|
||||
Pricing: []TrainingPrice{
|
||||
//{
|
||||
// Amount: decimal.NewFromInt(200),
|
||||
// Currency: "EUR",
|
||||
// Type: OPEN,
|
||||
//},
|
||||
//{
|
||||
// Amount: decimal.NewFromInt(1000),
|
||||
// Currency: "EUR",
|
||||
// Type: CORPORATE,
|
||||
//},
|
||||
//{
|
||||
// Amount: decimal.NewFromInt(4900),
|
||||
// Currency: "CZK",
|
||||
// Type: OPEN,
|
||||
//},
|
||||
//{
|
||||
// Amount: decimal.NewFromInt(24000),
|
||||
// Currency: "CZK",
|
||||
// Type: CORPORATE,
|
||||
//},
|
||||
{
|
||||
Amount: "200",
|
||||
Currency: "EUR",
|
||||
Type: OPEN,
|
||||
},
|
||||
{
|
||||
Amount: "1000",
|
||||
Currency: "EUR",
|
||||
Type: CORPORATE,
|
||||
},
|
||||
{
|
||||
Amount: "4900",
|
||||
Currency: "CZK",
|
||||
Type: OPEN,
|
||||
},
|
||||
{
|
||||
Amount: "24000",
|
||||
Currency: "CZK",
|
||||
Type: CORPORATE,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -120,7 +121,7 @@ func TestServer(t *testing.T) {
|
|||
assert.Equal(t, newTraining.Name, resultTraining.Name)
|
||||
assert.Equal(t, newTraining.Description, resultTraining.Description)
|
||||
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) {
|
||||
|
|
@ -178,11 +179,11 @@ func TestServer(t *testing.T) {
|
|||
Description: tr.Description,
|
||||
Days: tr.Days,
|
||||
Pricing: []TrainingPrice{
|
||||
//{
|
||||
// Amount: decimal.NewFromInt(200),
|
||||
// Currency: "EUR",
|
||||
// Type: OPEN,
|
||||
//},
|
||||
{
|
||||
Amount: decimal.NewFromInt(200).String(),
|
||||
Currency: money.EUR,
|
||||
Type: OPEN,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue