schema_test.go 496 B

1234567891011121314151617181920212223242526272829303132333435
  1. package schema
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/assert"
  5. )
  6. type dict map[string]interface{}
  7. func TestValid(t *testing.T) {
  8. config := dict{
  9. "version": "2.1",
  10. "services": dict{
  11. "foo": dict{
  12. "image": "busybox",
  13. },
  14. },
  15. }
  16. assert.NoError(t, Validate(config))
  17. }
  18. func TestUndefinedTopLevelOption(t *testing.T) {
  19. config := dict{
  20. "version": "2.1",
  21. "helicopters": dict{
  22. "foo": dict{
  23. "image": "busybox",
  24. },
  25. },
  26. }
  27. assert.Error(t, Validate(config))
  28. }