load_test.go 528 B

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