about summary refs log tree commit diff
path: root/src/state/messages/__tests__/convo.test.ts
blob: 34df5f94abe139b22216047af2b231fa817f9e4a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import {describe, it} from '@jest/globals'

describe(`#/state/messages/convo`, () => {
  describe(`init`, () => {
    it.todo(`fails if sender and recipients aren't found`)
    it.todo(`cannot re-initialize from a non-unintialized state`)
    it.todo(`can re-initialize from a failed state`)
  })

  describe(`resume`, () => {
    it.todo(`restores previous state if resume fails`)
  })

  describe(`suspend`, () => {
    it.todo(`cannot be interacted with when suspended`)
    it.todo(`polling is stopped when suspended`)
  })

  describe(`read states`, () => {
    it.todo(`should mark messages as read as they come in`)
  })

  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`,
    )
    it.todo(`pending messages are cleaned up from state after firehose event`)
  })

  describe(`deleting messages`, () => {
    it.todo(`messages are optimistically deleted from the chat`)
    it.todo(`messages are confirmed deleted via events from the server`)
    it.todo(`deleted messages are cleaned up from state after firehose event`)
  })

  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`,
    )
  })
})