Skip to content

Commit

Permalink
test: Fix a broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
Dobefu committed Dec 28, 2024
1 parent 95a8fbd commit a83d32f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 3 additions & 2 deletions cmd/cs_sdk/api/get-entry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import (
)

func TestGetEntry(t *testing.T) {
var entry interface{}
var entry map[string]interface{}
var emptyEntry map[string]interface{}
var err error

entry, err = GetEntry(structs.Route{
Expand All @@ -25,5 +26,5 @@ func TestGetEntry(t *testing.T) {
Locale: "en",
})
assert.NotEqual(t, nil, err)
assert.Equal(t, nil, entry)
assert.Equal(t, emptyEntry, entry)
}
10 changes: 8 additions & 2 deletions cmd/cs_sdk/functions/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

"github.com/Dobefu/csb/cmd/api"
"github.com/Dobefu/csb/cmd/cs_sdk"
sdk_api "github.com/Dobefu/csb/cmd/cs_sdk/api"
"github.com/Dobefu/csb/cmd/cs_sdk/structs"
"github.com/Dobefu/csb/cmd/cs_sdk/utils"
"github.com/Dobefu/csb/cmd/database/query"
Expand Down Expand Up @@ -420,7 +419,14 @@ func processSyncData(routes map[string]structs.Route) error {
}

func processTranslations(route structs.Route) {
entry, err := sdk_api.GetEntry(route)
path := fmt.Sprintf(
"content_types/%s/entries/%s?locale=%s",
route.ContentType,
route.Uid,
route.Locale,
)

entry, err := cs_sdk.Request(path, "GET", nil, false)

if err != nil {
return
Expand Down

0 comments on commit a83d32f

Please sign in to comment.