2026-07-28 13:35:59 +08:00
|
|
|
package models
|
|
|
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
|
|
|
|
|
func TestPlatformModelTableNames(t *testing.T) {
|
|
|
|
|
tests := []struct {
|
|
|
|
|
name string
|
|
|
|
|
table interface{ TableName() string }
|
|
|
|
|
want string
|
|
|
|
|
}{
|
|
|
|
|
{name: "account", table: &PlatformAccount{}, want: "platform_account"},
|
|
|
|
|
{name: "role", table: &PlatformRole{}, want: "platform_role"},
|
|
|
|
|
{name: "role menu", table: &PlatformRoleMenu{}, want: "platform_role_menu"},
|
2026-08-04 15:21:39 +08:00
|
|
|
{name: "producer account", table: &ProducerAccount{}, want: "producer_account"},
|
2026-07-28 13:35:59 +08:00
|
|
|
}
|
|
|
|
|
for _, test := range tests {
|
|
|
|
|
t.Run(test.name, func(t *testing.T) {
|
|
|
|
|
if got := test.table.TableName(); got != test.want {
|
|
|
|
|
t.Fatalf("TableName() = %q, want %q", got, test.want)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|