Nested folders: Fix missing URL from folder responses (#68082)
* Nested folders: Set URL in folder responses always * Apply suggestions from code review Co-authored-by: Arati R. <33031346+suntala@users.noreply.github.com>
This commit is contained in:
co-authored by
Arati R.
parent
7801cf6585
commit
d883404f50
@@ -72,6 +72,7 @@ func TestIntegrationCreate(t *testing.T) {
|
||||
assert.NotEmpty(t, f.ID)
|
||||
assert.Equal(t, uid, f.UID)
|
||||
assert.Empty(t, f.ParentUID)
|
||||
assert.NotEmpty(t, f.URL)
|
||||
|
||||
ff, err := folderStore.Get(context.Background(), folder.GetFolderQuery{
|
||||
UID: &f.UID,
|
||||
@@ -81,6 +82,7 @@ func TestIntegrationCreate(t *testing.T) {
|
||||
assert.Equal(t, folderTitle, ff.Title)
|
||||
assert.Equal(t, folderDsc, ff.Description)
|
||||
assert.Empty(t, ff.ParentUID)
|
||||
assert.NotEmpty(t, ff.URL)
|
||||
|
||||
assertAncestorUIDs(t, folderStore, f, []string{folder.GeneralFolderUID})
|
||||
})
|
||||
@@ -96,6 +98,7 @@ func TestIntegrationCreate(t *testing.T) {
|
||||
require.Equal(t, "parent", parent.Title)
|
||||
require.NotEmpty(t, parent.ID)
|
||||
assert.Equal(t, parentUID, parent.UID)
|
||||
assert.NotEmpty(t, parent.URL)
|
||||
|
||||
t.Cleanup(func() {
|
||||
err := folderStore.Delete(context.Background(), parent.UID, orgID)
|
||||
@@ -122,6 +125,7 @@ func TestIntegrationCreate(t *testing.T) {
|
||||
assert.NotEmpty(t, f.ID)
|
||||
assert.Equal(t, uid, f.UID)
|
||||
assert.Equal(t, parentUID, f.ParentUID)
|
||||
assert.NotEmpty(t, f.URL)
|
||||
|
||||
assertAncestorUIDs(t, folderStore, f, []string{folder.GeneralFolderUID, parent.UID})
|
||||
assertChildrenUIDs(t, folderStore, parent, []string{f.UID})
|
||||
@@ -134,6 +138,7 @@ func TestIntegrationCreate(t *testing.T) {
|
||||
assert.Equal(t, folderTitle, ff.Title)
|
||||
assert.Equal(t, folderDsc, ff.Description)
|
||||
assert.Equal(t, parentUID, ff.ParentUID)
|
||||
assert.NotEmpty(t, ff.URL)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -264,6 +269,7 @@ func TestIntegrationUpdate(t *testing.T) {
|
||||
assert.Equal(t, newTitle, updated.Title)
|
||||
assert.Equal(t, newDesc, updated.Description)
|
||||
assert.Equal(t, parent.UID, updated.ParentUID)
|
||||
assert.NotEmpty(t, updated.URL)
|
||||
// assert.GreaterOrEqual(t, updated.Updated.UnixNano(), existingUpdated.UnixNano())
|
||||
|
||||
updated, err = folderStore.Get(context.Background(), folder.GetFolderQuery{
|
||||
@@ -275,6 +281,7 @@ func TestIntegrationUpdate(t *testing.T) {
|
||||
assert.Equal(t, newDesc, updated.Description)
|
||||
// parent should not change
|
||||
assert.Equal(t, parent.UID, updated.ParentUID)
|
||||
assert.NotEmpty(t, updated.URL)
|
||||
|
||||
f = updated
|
||||
})
|
||||
@@ -300,6 +307,7 @@ func TestIntegrationUpdate(t *testing.T) {
|
||||
assert.Equal(t, newUID, updated.UID)
|
||||
assert.Equal(t, existingTitle, updated.Title)
|
||||
assert.Equal(t, existingDesc, updated.Description)
|
||||
assert.NotEmpty(t, updated.URL)
|
||||
})
|
||||
|
||||
t.Run("updating folder parent UID", func(t *testing.T) {
|
||||
@@ -374,6 +382,7 @@ func TestIntegrationUpdate(t *testing.T) {
|
||||
assert.Equal(t, existingTitle, updated.Title)
|
||||
assert.Equal(t, existingDesc, updated.Description)
|
||||
assert.Equal(t, existingUID, updated.UID)
|
||||
assert.NotEmpty(t, updated.URL)
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -423,6 +432,7 @@ func TestIntegrationGet(t *testing.T) {
|
||||
//assert.Equal(t, folder.GeneralFolderUID, ff.ParentUID)
|
||||
assert.NotEmpty(t, ff.Created)
|
||||
assert.NotEmpty(t, ff.Updated)
|
||||
assert.NotEmpty(t, ff.URL)
|
||||
})
|
||||
|
||||
t.Run("get folder by title should succeed", func(t *testing.T) {
|
||||
@@ -439,6 +449,7 @@ func TestIntegrationGet(t *testing.T) {
|
||||
//assert.Equal(t, folder.GeneralFolderUID, ff.ParentUID)
|
||||
assert.NotEmpty(t, ff.Created)
|
||||
assert.NotEmpty(t, ff.Updated)
|
||||
assert.NotEmpty(t, ff.URL)
|
||||
})
|
||||
|
||||
t.Run("get folder by title should succeed", func(t *testing.T) {
|
||||
@@ -454,6 +465,7 @@ func TestIntegrationGet(t *testing.T) {
|
||||
//assert.Equal(t, folder.GeneralFolderUID, ff.ParentUID)
|
||||
assert.NotEmpty(t, ff.Created)
|
||||
assert.NotEmpty(t, ff.Updated)
|
||||
assert.NotEmpty(t, ff.URL)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -518,6 +530,7 @@ func TestIntegrationGetParents(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
parentUIDs := make([]string, 0)
|
||||
for _, p := range parents {
|
||||
assert.NotEmpty(t, p.URL)
|
||||
parentUIDs = append(parentUIDs, p.UID)
|
||||
}
|
||||
require.Equal(t, []string{uid1}, parentUIDs)
|
||||
@@ -570,6 +583,7 @@ func TestIntegrationGetChildren(t *testing.T) {
|
||||
|
||||
childrenUIDs := make([]string, 0, len(children))
|
||||
for _, c := range children {
|
||||
assert.NotEmpty(t, c.URL)
|
||||
childrenUIDs = append(childrenUIDs, c.UID)
|
||||
}
|
||||
|
||||
@@ -586,6 +600,7 @@ func TestIntegrationGetChildren(t *testing.T) {
|
||||
|
||||
childrenUIDs := make([]string, 0, len(children))
|
||||
for _, c := range children {
|
||||
assert.NotEmpty(t, c.URL)
|
||||
childrenUIDs = append(childrenUIDs, c.UID)
|
||||
}
|
||||
assert.Equal(t, []string{parent.UID}, childrenUIDs)
|
||||
@@ -618,6 +633,7 @@ func TestIntegrationGetChildren(t *testing.T) {
|
||||
|
||||
childrenUIDs = make([]string, 0, len(children))
|
||||
for _, c := range children {
|
||||
assert.NotEmpty(t, c.URL)
|
||||
childrenUIDs = append(childrenUIDs, c.UID)
|
||||
}
|
||||
|
||||
@@ -635,6 +651,7 @@ func TestIntegrationGetChildren(t *testing.T) {
|
||||
|
||||
childrenUIDs = make([]string, 0, len(children))
|
||||
for _, c := range children {
|
||||
assert.NotEmpty(t, c.URL)
|
||||
childrenUIDs = append(childrenUIDs, c.UID)
|
||||
}
|
||||
|
||||
@@ -652,6 +669,7 @@ func TestIntegrationGetChildren(t *testing.T) {
|
||||
|
||||
childrenUIDs = make([]string, 0, len(children))
|
||||
for _, c := range children {
|
||||
assert.NotEmpty(t, c.URL)
|
||||
childrenUIDs = append(childrenUIDs, c.UID)
|
||||
}
|
||||
|
||||
@@ -669,6 +687,7 @@ func TestIntegrationGetChildren(t *testing.T) {
|
||||
|
||||
childrenUIDs = make([]string, 0, len(children))
|
||||
for _, c := range children {
|
||||
assert.NotEmpty(t, c.URL)
|
||||
childrenUIDs = append(childrenUIDs, c.UID)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user