|
@ -5,7 +5,7 @@ import ( |
|
|
"testing" |
|
|
"testing" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
func TestDeserializeOptions(t *testing.T) { |
|
|
|
|
|
|
|
|
func TestDeserializeOptionsResizeImage(t *testing.T) { |
|
|
const Payload string = `{ |
|
|
const Payload string = `{ |
|
|
"name": "example pipeline", |
|
|
"name": "example pipeline", |
|
|
"type": 0, |
|
|
"type": 0, |
|
@ -32,6 +32,31 @@ func TestDeserializeOptions(t *testing.T) { |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func TestDeserializeOptionsCompressImage(t *testing.T) { |
|
|
|
|
|
const Payload string = `{ |
|
|
|
|
|
"name": "example pipeline", |
|
|
|
|
|
"type": 0, |
|
|
|
|
|
"removeMetadata": false, |
|
|
|
|
|
"steps": [ |
|
|
|
|
|
{ |
|
|
|
|
|
"name": "compress image", |
|
|
|
|
|
"type": 1, |
|
|
|
|
|
"options": { |
|
|
|
|
|
"quality": 80 |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
] |
|
|
|
|
|
}` |
|
|
|
|
|
|
|
|
|
|
|
t.Run("Image pipeline deserialization is successful", func(t *testing.T) { |
|
|
|
|
|
values := DeserializePipelines([][]byte{[]byte(Payload)}) |
|
|
|
|
|
|
|
|
|
|
|
_, err := values[0].GetSteps()[0].Translate() |
|
|
|
|
|
|
|
|
|
|
|
assert.Equal(t, nil, err) |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
func TestDeserializeMissingOptions(t *testing.T) { |
|
|
func TestDeserializeMissingOptions(t *testing.T) { |
|
|
const Payload string = `{ |
|
|
const Payload string = `{ |
|
|
"name": "example pipeline", |
|
|
"name": "example pipeline", |
|
|