mirror of
https://github.com/pocketbase/pocketbase.git
synced 2026-11-15 16:28:06 +01:00
added Store.Keys()
This commit is contained in:
1 parent
bf1f164014
commit
25dc8a8eea
2 files changed
+36
-1
No files matched your search
@@ -205,6 +205,27 @@ func TestGetAll(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestKeys(t *testing.T) {
|
||||
data := map[string]int{
|
||||
"a": 1,
|
||||
"b": 2,
|
||||
}
|
||||
|
||||
keys := store.New(data).Keys()
|
||||
|
||||
expected := []string{"a", "b"}
|
||||
|
||||
if len(keys) != len(expected) {
|
||||
t.Fatalf("Expected %d keys, got %d", len(expected), len(keys))
|
||||
}
|
||||
|
||||
for _, k := range expected {
|
||||
if !slices.Contains(keys, k) {
|
||||
t.Fatalf("Missing key %s in\n%v", k, keys)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestValues(t *testing.T) {
|
||||
data := map[string]int{
|
||||
"a": 1,
|
||||
|
||||
Reference in new issue
Block a user