package ocean_test import ( "testing" "git.akyoto.dev/go/assert" "git.akyoto.dev/go/ocean" ) func TestCollectionGet(t *testing.T) { users := ocean.NewCollection[string]("User") users.Set("1", "abc") user, exists := users.Get("1") assert.True(t, exists) assert.NotNil(t, user) } func TestCollectionAll(t *testing.T) { users := ocean.NewCollection[string]("User") users.Set("1", "abc") users.Set("2", "def") count := 0 for range users.All() { count++ } assert.Equal(t, count, 2) } func TestInteraction(t *testing.T) { users := ocean.NewCollection[string]("User") assert.True(t, !users.Exists("1")) assert.True(t, !users.Exists("2")) users.Set("1", "abc") assert.True(t, users.Exists("1")) assert.True(t, !users.Exists("2")) users.Set("2", "def") assert.True(t, users.Exists("1")) assert.True(t, users.Exists("2")) users.Delete("1") assert.True(t, !users.Exists("1")) assert.True(t, users.Exists("2")) users.Delete("2") assert.True(t, !users.Exists("1")) assert.True(t, !users.Exists("2")) }