about summary refs log tree commit diff
path: root/src/state/messages/__tests__
diff options
context:
space:
mode:
Diffstat (limited to 'src/state/messages/__tests__')
-rw-r--r--src/state/messages/__tests__/client.test.ts38
-rw-r--r--src/state/messages/__tests__/convo.test.ts57
2 files changed, 57 insertions, 38 deletions
diff --git a/src/state/messages/__tests__/client.test.ts b/src/state/messages/__tests__/client.test.ts
deleted file mode 100644
index cab1d9021..000000000
--- a/src/state/messages/__tests__/client.test.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-import {describe, it} from '@jest/globals'
-
-describe(`#/state/dms/client`, () => {
-  describe(`ChatsService`, () => {
-    describe(`unread count`, () => {
-      it.todo(`marks a chat as read, decrements total unread count`)
-    })
-
-    describe(`log processing`, () => {
-      /*
-       * We receive a new chat log AND messages for it in the same batch. We
-       * need to first initialize the chat, then process the received logs.
-       */
-      describe(`handles new chats and subsequent messages received in same log batch`, () => {
-        it.todo(`receives new chat and messages`)
-        it.todo(
-          `receives new chat, new messages come in while still initializing new chat`,
-        )
-      })
-    })
-
-    describe(`reset state`, () => {
-      it.todo(`after period of inactivity, rehydrates entirely fresh state`)
-    })
-  })
-
-  describe(`ChatService`, () => {
-    describe(`history fetching`, () => {
-      it.todo(`fetches initial chat history`)
-      it.todo(`fetches additional chat history`)
-      it.todo(`handles history fetch failure`)
-    })
-
-    describe(`optimistic updates`, () => {
-      it.todo(`adds sending messages`)
-    })
-  })
-})
diff --git a/src/state/messages/__tests__/convo.test.ts b/src/state/messages/__tests__/convo.test.ts
new file mode 100644
index 000000000..03f9218ff
--- /dev/null
+++ b/src/state/messages/__tests__/convo.test.ts
@@ -0,0 +1,57 @@
+import {describe, it} from '@jest/globals'
+
+describe(`#/state/messages/convo`, () => {
+  describe(`status states`, () => {
+    it.todo(`cannot re-initialize from a non-unintialized state`)
+    it.todo(`can re-initialize from a failed state`)
+
+    describe(`destroy`, () => {
+      it.todo(`cannot be interacted with when destroyed`)
+      it.todo(`polling is stopped when destroyed`)
+      it.todo(`events are cleaned up when destroyed`)
+    })
+  })
+
+  describe(`history fetching`, () => {
+    it.todo(`fetches initial chat history`)
+    it.todo(`fetches additional chat history`)
+    it.todo(`handles history fetch failure`)
+    it.todo(`does not insert deleted messages`)
+  })
+
+  describe(`sending messages`, () => {
+    it.todo(`optimistically adds sending messages`)
+    it.todo(`sends messages in order`)
+    it.todo(`failed message send fails all sending messages`)
+    it.todo(`can retry all failed messages via retry ConvoItem`)
+    it.todo(
+      `successfully sent messages are re-ordered, if needed, by events received from server`,
+    )
+  })
+
+  describe(`deleting messages`, () => {
+    it.todo(`messages are optimistically deleted from the chat`)
+    it.todo(`messages are confirmed deleted via events from the server`)
+  })
+
+  describe(`log handling`, () => {
+    it.todo(`updates rev to latest message received`)
+    it.todo(`only handles log events for this convoId`)
+    it.todo(`does not insert deleted messages`)
+  })
+
+  describe(`item ordering`, () => {
+    it.todo(`pending items are first, and in order`)
+    it.todo(`new message items are next, and in order`)
+    it.todo(`past message items are next, and in order`)
+  })
+
+  describe(`inactivity`, () => {
+    it.todo(
+      `below a certain threshold of inactivity, restore entirely from log`,
+    )
+    it.todo(
+      `above a certain threshold of inactivity, rehydrate entirely fresh state`,
+    )
+  })
+})