mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 11:08:10 +00:00
sdk: Fix fmt + add FieldType test (#19493)
* sdk: Fix fmt + add FieldType test * Add test comment
This commit is contained in:
@@ -2,6 +2,7 @@ package framework
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"strings"
|
||||
@@ -811,3 +812,23 @@ func TestInitializeBackend(t *testing.T) {
|
||||
t.Fatal("backend should be open")
|
||||
}
|
||||
}
|
||||
|
||||
// TestFieldTypeMethods tries to ensure our switch-case statements for the
|
||||
// FieldType "enum" are complete.
|
||||
func TestFieldTypeMethods(t *testing.T) {
|
||||
unknownFormat := convertType(TypeInvalid).format
|
||||
|
||||
for i := TypeInvalid + 1; i < typeInvalidMax; i++ {
|
||||
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
|
||||
if i.String() == TypeInvalid.String() {
|
||||
t.Errorf("unknown type string for %d", i)
|
||||
}
|
||||
|
||||
if convertType(i).format == unknownFormat {
|
||||
t.Errorf("unknown schema for %d", i)
|
||||
}
|
||||
|
||||
_ = i.Zero()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user