Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.2.0 #142

Merged
merged 4 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions lib/tests/channel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ describe("Channel test", () => {

let { membership } = await channel.join(() => null)
let unreadCount = await membership.getUnreadMessagesCount()
expect(unreadCount).toBe(false)
expect(unreadCount).toBe(0)

const { messages } = await channel.getHistory()
membership = await membership.setLastReadMessageTimetoken(messages[0].timetoken)
Expand Down Expand Up @@ -637,16 +637,15 @@ describe("Channel test", () => {
})

test("should correctly stream read receipts", async () => {
const randomTimetoken = "123456789123456789"
const { membership } = await channel.join(undefined, {
custom: { lastReadMessageTimetoken: randomTimetoken },
})
channel.disconnect()
const { membership, disconnect } = await channel.join(() => null)
disconnect()

const mockCallback = jest.fn()
const stopReceipts = await channel.streamReadReceipts(mockCallback)
expect(mockCallback).toHaveBeenCalledTimes(1)
expect(mockCallback).toHaveBeenCalledWith({ [randomTimetoken]: ["test-user"] })
expect(mockCallback).toHaveBeenCalledWith({
[membership.lastReadMessageTimetoken]: ["test-user"],
})

const { timetoken } = await channel.sendText("New message")
await sleep(150) // history calls have around 130ms of cache time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export function HomeScreen({ navigation }: StackScreenProps<HomeStackParamList,

useEffect(() => {
const disconnectFuncs = channels.map((ch) =>
ch.connect((message) => {
ch.connect(() => {
fetchUnreadMessagesCount()
})
)
Expand Down
Loading