Micro-service for file storage and processing written in Go
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

  1. package main
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/assert"
  5. )
  6. const ValidPayload string = `{
  7. "name": "example pipeline",
  8. "type": 0,
  9. "removeMetadata": false,
  10. "steps": [
  11. {
  12. "name": "resize image",
  13. "type": 0
  14. },
  15. {
  16. "name": "compress image",
  17. "type": 1
  18. }
  19. ]
  20. }`
  21. func TestPipelineDeserialization(t *testing.T) {
  22. t.Run("Pipelines deserialization is successful", func(t *testing.T) {
  23. values := DeserializePipelines([][]byte{[]byte(ValidPayload)})
  24. assert.Equal(t, 1, len(values), "Output should contain one element")
  25. assert.Equal(t, "example pipeline", values[0].Name)
  26. })
  27. }