github.com/SAP/cloud-mta-build-tool@v1.2.27/internal/conttype/process_test.go (about)

     1  package conttype
     2  
     3  import (
     4  	. "github.com/onsi/ginkgo"
     5  	. "github.com/onsi/gomega"
     6  )
     7  
     8  var _ = Describe("Process", func() {
     9  	It("content types getting", func() {
    10  		contentTypes, err := GetContentTypes()
    11  		Ω(err).Should(Succeed())
    12  		Ω(GetContentType(contentTypes, ".json")).Should(Equal("application/json"))
    13  		_, err = GetContentType(contentTypes, ".unknown")
    14  		Ω(err).Should(HaveOccurred())
    15  	})
    16  
    17  	It("content types - wrong config", func() {
    18  
    19  		cfg := ContentTypeConfig
    20  		ContentTypeConfig = []byte(`
    21  content-types:
    22  - extension: .json
    23    content-typex: "application/json"
    24  `)
    25  		_, err := GetContentTypes()
    26  		Ω(err).Should(HaveOccurred())
    27  		ContentTypeConfig = cfg
    28  	})
    29  })