summaryrefslogtreecommitdiffhomepage
path: root/resources/resource_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2020-12-17 09:33:26 +0100
committerBjørn Erik Pedersen <[email protected]>2020-12-17 22:20:12 +0100
commit81975f847dc19c21c2321207645807771db97fab (patch)
tree6658282e788f305d5c3a6c55692921ff317732f5 /resources/resource_test.go
parent8103188b9b9e8eeb3bcb53c8b64e2b83397e82ae (diff)
downloadhugo-81975f847dc19c21c2321207645807771db97fab.tar.gz
hugo-81975f847dc19c21c2321207645807771db97fab.zip
Fix Resource.ResourceType so it always returns MIME's main type
The one exception being for the Page, which does not have a MIME type, in which you will get the value `page`. Fixes #8052
Diffstat (limited to 'resources/resource_test.go')
-rw-r--r--resources/resource_test.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/resources/resource_test.go b/resources/resource_test.go
index f015cd6c9..571dd6de1 100644
--- a/resources/resource_test.go
+++ b/resources/resource_test.go
@@ -38,7 +38,7 @@ func TestGenericResource(t *testing.T) {
c.Assert(r.Permalink(), qt.Equals, "https://example.com/foo.css")
c.Assert(r.RelPermalink(), qt.Equals, "/foo.css")
- c.Assert(r.ResourceType(), qt.Equals, "css")
+ c.Assert(r.ResourceType(), qt.Equals, "text")
}
func TestGenericResourceWithLinkFactory(t *testing.T) {
@@ -52,7 +52,7 @@ func TestGenericResourceWithLinkFactory(t *testing.T) {
c.Assert(r.Permalink(), qt.Equals, "https://example.com/foo/foo.css")
c.Assert(r.RelPermalink(), qt.Equals, "/foo/foo.css")
c.Assert(r.Key(), qt.Equals, "/foo/foo.css")
- c.Assert(r.ResourceType(), qt.Equals, "css")
+ c.Assert(r.ResourceType(), qt.Equals, "text")
}
func TestNewResourceFromFilename(t *testing.T) {
@@ -76,7 +76,7 @@ func TestNewResourceFromFilename(t *testing.T) {
c.Assert(err, qt.IsNil)
c.Assert(r, qt.Not(qt.IsNil))
- c.Assert(r.ResourceType(), qt.Equals, "json")
+ c.Assert(r.ResourceType(), qt.Equals, "application")
}
func TestNewResourceFromFilenameSubPathInBaseURL(t *testing.T) {
@@ -108,7 +108,7 @@ func TestResourcesByType(t *testing.T) {
spec.newGenericResource(nil, nil, nil, "/a/foo3.css", "foo3.css", media.CSSType),
}
- c.Assert(len(resources.ByType("css")), qt.Equals, 3)
+ c.Assert(len(resources.ByType("text")), qt.Equals, 3)
c.Assert(len(resources.ByType("image")), qt.Equals, 1)
}