api_test.go 814 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // +build 1.6,codegen
  2. package api
  3. import (
  4. "testing"
  5. "github.com/stretchr/testify/assert"
  6. )
  7. func TestStructNameWithFullName(t *testing.T) {
  8. a := API{
  9. Metadata: Metadata{
  10. ServiceFullName: "Amazon Service Name-100",
  11. },
  12. }
  13. assert.Equal(t, a.StructName(), "ServiceName100")
  14. }
  15. func TestStructNameWithAbbreviation(t *testing.T) {
  16. a := API{
  17. Metadata: Metadata{
  18. ServiceFullName: "AWS Service Name-100",
  19. ServiceAbbreviation: "AWS SN100",
  20. },
  21. }
  22. assert.Equal(t, a.StructName(), "SN100")
  23. }
  24. func TestStructNameForExceptions(t *testing.T) {
  25. a := API{
  26. Metadata: Metadata{
  27. ServiceFullName: "Elastic Load Balancing",
  28. },
  29. }
  30. assert.Equal(t, a.StructName(), "ELB")
  31. a = API{
  32. Metadata: Metadata{
  33. ServiceFullName: "AWS Config",
  34. },
  35. }
  36. assert.Equal(t, a.StructName(), "ConfigService")
  37. }