Improved tests

This commit is contained in:
Eduard Urbach 2023-07-06 17:50:48 +02:00
parent ef00ca9698
commit 9b956ac441
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0

View File

@ -11,19 +11,7 @@ type User struct {
Name string `json:"name"`
}
func TestGet(t *testing.T) {
users, err := ocean.New[User]("test")
assert.Nil(t, err)
defer users.Clear()
users.Set("1", &User{Name: "User 1"})
user, err := users.Get("1")
assert.Nil(t, err)
assert.NotNil(t, user)
}
func TestCollectionAll(t *testing.T) {
func TestAll(t *testing.T) {
users, err := ocean.New[User]("test")
assert.Nil(t, err)
defer users.Clear()
@ -39,6 +27,18 @@ func TestCollectionAll(t *testing.T) {
assert.Equal(t, count, 2)
}
func TestGet(t *testing.T) {
users, err := ocean.New[User]("test")
assert.Nil(t, err)
defer users.Clear()
users.Set("1", &User{Name: "User 1"})
user, err := users.Get("1")
assert.Nil(t, err)
assert.NotNil(t, user)
}
func TestInteraction(t *testing.T) {
users, err := ocean.New[User]("test")
assert.Nil(t, err)