aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/app/state/state_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-09-29 02:33:10 +0900
committerOphestra <cat@gensokyo.uk>2025-09-29 06:11:47 +0900
commit46cd3a28c83e93b5d66c52d06a8366c11910d5c0 (patch)
tree6e25c5078b5cd9de78b7a6c9b253f1132358812b /internal/app/state/state_test.go
parentad1bc6794f0053c3e63eab408a0d530d53e8b51c (diff)
container: remove global msg
This frees all container instances of side effects. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/app/state/state_test.go')
-rw-r--r--internal/app/state/state_test.go32
1 files changed, 16 insertions, 16 deletions
diff --git a/internal/app/state/state_test.go b/internal/app/state/state_test.go
index 0025918d..cc578652 100644
--- a/internal/app/state/state_test.go
+++ b/internal/app/state/state_test.go
@@ -16,10 +16,10 @@ import (
func testStore(t *testing.T, s state.Store) {
t.Run("list empty store", func(t *testing.T) {
- if aids, err := s.List(); err != nil {
+ if identities, err := s.List(); err != nil {
t.Fatalf("List: error = %v", err)
- } else if len(aids) != 0 {
- t.Fatalf("List: aids = %#v", aids)
+ } else if len(identities) != 0 {
+ t.Fatalf("List: identities = %#v", identities)
}
})
@@ -39,22 +39,22 @@ func testStore(t *testing.T, s state.Store) {
makeState(t, &tc[i].state, &tc[i].ct)
}
- do := func(aid int, f func(c state.Cursor)) {
- if ok, err := s.Do(aid, f); err != nil {
+ do := func(identity int, f func(c state.Cursor)) {
+ if ok, err := s.Do(identity, f); err != nil {
t.Fatalf("Do: ok = %v, error = %v", ok, err)
}
}
- insert := func(i, aid int) {
- do(aid, func(c state.Cursor) {
+ insert := func(i, identity int) {
+ do(identity, func(c state.Cursor) {
if err := c.Save(&tc[i].state, &tc[i].ct); err != nil {
t.Fatalf("Save(&tc[%v]): error = %v", i, err)
}
})
}
- check := func(i, aid int) {
- do(aid, func(c state.Cursor) {
+ check := func(i, identity int) {
+ do(identity, func(c state.Cursor) {
if entries, err := c.Load(); err != nil {
t.Fatalf("Load: error = %v", err)
} else if got, ok := entries[tc[i].state.ID]; !ok {
@@ -81,7 +81,7 @@ func testStore(t *testing.T, s state.Store) {
insert(insertEntryNoCheck, 0)
})
- t.Run("insert entry different aid", func(t *testing.T) {
+ t.Run("insert entry different identity", func(t *testing.T) {
insert(insertEntryOtherApp, 1)
check(insertEntryOtherApp, 1)
})
@@ -90,14 +90,14 @@ func testStore(t *testing.T, s state.Store) {
check(insertEntryNoCheck, 0)
})
- t.Run("list aids", func(t *testing.T) {
- if aids, err := s.List(); err != nil {
+ t.Run("list identities", func(t *testing.T) {
+ if identities, err := s.List(); err != nil {
t.Fatalf("List: error = %v", err)
} else {
- slices.Sort(aids)
+ slices.Sort(identities)
want := []int{0, 1}
- if !slices.Equal(aids, want) {
- t.Fatalf("List() = %#v, want %#v", aids, want)
+ if !slices.Equal(identities, want) {
+ t.Fatalf("List() = %#v, want %#v", identities, want)
}
}
})
@@ -110,7 +110,7 @@ func testStore(t *testing.T, s state.Store) {
}
})
- t.Run("clear aid 1", func(t *testing.T) {
+ t.Run("clear identity 1", func(t *testing.T) {
do(1, func(c state.Cursor) {
if err := c.Destroy(tc[insertEntryOtherApp].state.ID); err != nil {
t.Fatalf("Destroy: error = %v", err)