api_test.go 791 B

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