|
|
package main
import ( "github.com/stretchr/testify/assert" "testing" )
const ValidImagePayload string = `{ "name": "example pipeline", "type": 0, "removeMetadata": false, "steps": [ { "name": "resize image", "type": 0 }, { "name": "compress image", "type": 1 } ] }`
func TestImagePipelineDeserialization(t *testing.T) { t.Run("Image pipeline deserialization is successful", func(t *testing.T) { values := DeserializePipelines([][]byte{[]byte(ValidImagePayload)})
assert.Equal(t, 1, len(values), "Output should contain one element") assert.Equal(t, "example pipeline", values[0].GetName()) assert.Equal(t, Image, values[0].GetType()) }) }
const ValidVideoPayload string = `{ "name": "example pipeline", "type": 1, "removeMetadata": false, "steps": [ { "name": "resize image", "type": 0 }, { "name": "compress image", "type": 1 } ] }`
func TestVideoPipelineDeserialization(t *testing.T) { t.Run("Video pipelines deserialization is successful", func(t *testing.T) { values := DeserializePipelines([][]byte{[]byte(ValidVideoPayload)})
assert.Equal(t, 1, len(values), "Output should contain one element") assert.Equal(t, "example pipeline", values[0].GetName()) assert.Equal(t, Video, values[0].GetType()) }) }
|