load_test.go 551 B

1234567891011121314151617181920212223242526272829303132
  1. // +build 1.6,codegen
  2. package api
  3. import (
  4. "testing"
  5. "github.com/stretchr/testify/assert"
  6. )
  7. func TestResolvedReferences(t *testing.T) {
  8. json := `{
  9. "operations": {
  10. "OperationName": {
  11. "input": { "shape": "TestName" }
  12. }
  13. },
  14. "shapes": {
  15. "TestName": {
  16. "type": "structure",
  17. "members": {
  18. "memberName1": { "shape": "OtherTest" },
  19. "memberName2": { "shape": "OtherTest" }
  20. }
  21. },
  22. "OtherTest": { "type": "string" }
  23. }
  24. }`
  25. a := API{}
  26. a.AttachString(json)
  27. assert.Equal(t, len(a.Shapes["OtherTest"].refs), 2)
  28. }