New test TestGetSkillCategoryAndDifficultyNewSystem in chain of learning system

Updated learning_skill_category_difficulties to match rule set
This commit is contained in:
2026-01-31 08:36:47 +01:00
parent 7ef9b2f17a
commit 3297c408d2
2 changed files with 75 additions and 1 deletions
+1 -1
View File
@@ -151,7 +151,7 @@ type SkillLearningInfo struct {
CategoryName string `json:"category_name"`
DifficultyID uint `json:"difficulty_id"`
DifficultyName string `json:"difficulty_name"`
LearnCost int `json:"learn_cost"`
LearnCost int `json:"learn_cost"` // LE-Kosten für das Erlernen
CharacterClassID uint `json:"character_class_id"`
ClassCode string `json:"class_code"`
ClassName string `json:"class_name"`
@@ -631,6 +631,80 @@ func TestGetSpellLearningInfoNewSystem(t *testing.T) {
}
}
func TestGetSkillCategoryAndDifficultyNewSystem(t *testing.T) {
database.SetupTestDB(true)
defer database.ResetTestDB()
tests := []struct {
TestName string
SkillName string
ClassCode string
CategoryName string
DifficultyName string
EPPerTE int
LearnCost int
expError bool
}{
{
TestName: "Schwimmen for Barbar",
SkillName: "Schwimmen",
ClassCode: "Bb",
CategoryName: "Körper",
DifficultyName: "leicht",
EPPerTE: 10,
LearnCost: 1,
expError: false,
}, {
TestName: "Abrichten for Barbar",
SkillName: "Abrichten",
ClassCode: "Bb",
CategoryName: "Freiland",
DifficultyName: "schwer",
EPPerTE: 10,
LearnCost: 4,
expError: false,
}, {
TestName: "Betäuben for Schamane",
SkillName: "Betäuben",
ClassCode: "Sc",
CategoryName: "Kampf",
DifficultyName: "schwer",
EPPerTE: 40,
LearnCost: 10,
expError: false,
},
{
TestName: "Invalid skill",
SkillName: "InvalidSkill",
ClassCode: "Bb",
CategoryName: "",
DifficultyName: "",
EPPerTE: 0,
LearnCost: 0,
expError: true,
},
}
for _, tt := range tests {
t.Run(tt.TestName, func(t *testing.T) {
info, err := GetSkillCategoryAndDifficultyNewSystem(tt.SkillName, tt.ClassCode)
if tt.expError {
assert.Error(t, err)
return
}
require.NoError(t, err)
require.NotNil(t, info)
assert.Equal(t, tt.SkillName, info.SkillName)
assert.Equal(t, tt.CategoryName, info.CategoryName, info.SkillName)
assert.Equal(t, tt.DifficultyName, info.DifficultyName, info.SkillName)
assert.Equal(t, tt.EPPerTE, info.EPPerTE, info.SkillName)
assert.Equal(t, tt.LearnCost, info.LearnCost, info.SkillName)
})
}
}
/*
func TestGetSpellLearningInfoNewSystem_NotExistingForCurrentGameSystem(t *testing.T) {
database.ResetTestDB()