✅ Fixed FileSystem repositoryes tests of Site and Page
This commit is contained in:
parent
c9db0f0ce0
commit
f3eca3dc73
|
@ -33,41 +33,46 @@ func TestGet(t *testing.T) {
|
|||
"index": {
|
||||
input: path.Join("index"),
|
||||
expect: &domain.Page{
|
||||
Content: []byte("index.md"),
|
||||
Params: make(map[string]any),
|
||||
Resources: make([]*domain.Resource, 0),
|
||||
Content: []byte("index.md"),
|
||||
Params: make(map[string]any),
|
||||
Resources: make([]*domain.Resource, 0),
|
||||
Translations: make([]*domain.Page, 0),
|
||||
},
|
||||
},
|
||||
"file": {
|
||||
input: path.Join("file"),
|
||||
expect: &domain.Page{
|
||||
Content: []byte("file.md"),
|
||||
Params: make(map[string]any),
|
||||
Resources: make([]*domain.Resource, 0),
|
||||
Content: []byte("file.md"),
|
||||
Params: make(map[string]any),
|
||||
Resources: make([]*domain.Resource, 0),
|
||||
Translations: make([]*domain.Page, 0),
|
||||
},
|
||||
},
|
||||
"folder": {
|
||||
input: path.Join("folder", "index"),
|
||||
expect: &domain.Page{
|
||||
Content: []byte("folder/index.md"),
|
||||
Params: make(map[string]any),
|
||||
Resources: make([]*domain.Resource, 0),
|
||||
Content: []byte("folder/index.md"),
|
||||
Params: make(map[string]any),
|
||||
Resources: make([]*domain.Resource, 0),
|
||||
Translations: make([]*domain.Page, 0),
|
||||
},
|
||||
},
|
||||
"both-file": {
|
||||
input: path.Join("both"),
|
||||
expect: &domain.Page{
|
||||
Content: []byte("both.md"),
|
||||
Params: make(map[string]any),
|
||||
Resources: make([]*domain.Resource, 0),
|
||||
Content: []byte("both.md"),
|
||||
Params: make(map[string]any),
|
||||
Resources: make([]*domain.Resource, 0),
|
||||
Translations: make([]*domain.Page, 0),
|
||||
},
|
||||
},
|
||||
"both-folder": {
|
||||
input: path.Join("both", "index"),
|
||||
expect: &domain.Page{
|
||||
Content: []byte("both/index.md"),
|
||||
Params: make(map[string]any),
|
||||
Resources: make([]*domain.Resource, 0),
|
||||
Content: []byte("both/index.md"),
|
||||
Params: make(map[string]any),
|
||||
Resources: make([]*domain.Resource, 0),
|
||||
Translations: make([]*domain.Page, 0),
|
||||
},
|
||||
},
|
||||
} {
|
||||
|
@ -81,7 +86,14 @@ func TestGet(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if diff := cmp.Diff(out, tc.expect, cmp.AllowUnexported(domain.File{}, domain.LanguageUnd)); diff != "" {
|
||||
if diff := cmp.Diff(out, tc.expect, cmp.FilterPath(func(p cmp.Path) bool {
|
||||
switch p.String() {
|
||||
default:
|
||||
return false
|
||||
case "File", "Language":
|
||||
return true
|
||||
}
|
||||
}, cmp.Ignore())); diff != "" {
|
||||
t.Error(diff)
|
||||
}
|
||||
})
|
||||
|
|
|
@ -58,7 +58,14 @@ func TestGet(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if diff := cmp.Diff(out, tc.expect, cmp.AllowUnexported(domain.LanguageUnd, domain.File{})); diff != "" {
|
||||
if diff := cmp.Diff(out, tc.expect, cmp.FilterPath(func(p cmp.Path) bool {
|
||||
switch p.String() {
|
||||
default:
|
||||
return false
|
||||
case "File", "Language":
|
||||
return true
|
||||
}
|
||||
}, cmp.Ignore())); diff != "" {
|
||||
t.Error(diff)
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue