You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
684 B
32 lines
684 B
package main
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
const ValidPayload string = `{
|
|
"name": "example pipeline",
|
|
"type": 0,
|
|
"removeMetadata": false,
|
|
"steps": [
|
|
{
|
|
"name": "resize image",
|
|
"type": 0
|
|
},
|
|
{
|
|
"name": "compress image",
|
|
"type": 1
|
|
}
|
|
]
|
|
}`
|
|
|
|
func TestPipelineDeserialization(t *testing.T) {
|
|
t.Run("Pipelines deserialization is successful", func(t *testing.T) {
|
|
values := DeserializePipelines([][]byte{[]byte(ValidPayload)})
|
|
|
|
assert.Equal(t, 1, len(values), "Output should contain one element")
|
|
assert.Equal(t, "example pipeline", values[0].Name)
|
|
})
|
|
}
|