@linktr.ee/messaging-react 2.4.2 → 2.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linktr.ee/messaging-react",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.3",
|
|
4
4
|
"description": "React messaging components built on messaging-core for web applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"react-dom": "^18.3.1",
|
|
63
63
|
"storybook": "^8.5.0",
|
|
64
64
|
"stream-chat": "^9.26.0",
|
|
65
|
-
"stream-chat-react": "^13.
|
|
65
|
+
"stream-chat-react": "^13.14.5",
|
|
66
66
|
"tailwindcss": "^3.4.17",
|
|
67
67
|
"tailwindcss-animate": "^1.0.7",
|
|
68
68
|
"typescript": "5.9.2",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { StreamChatService } from '@linktr.ee/messaging-core'
|
|
2
|
+
import type { MessagingUser } from '@linktr.ee/messaging-core'
|
|
2
3
|
import { render, waitFor, act } from '@testing-library/react'
|
|
3
4
|
import React from 'react'
|
|
4
5
|
import type { StreamChat } from 'stream-chat'
|
|
@@ -51,12 +52,18 @@ describe('MessagingProvider', () => {
|
|
|
51
52
|
it('connects a guest user through the underlying service', async () => {
|
|
52
53
|
const { connectUser } = setupServiceMock()
|
|
53
54
|
const states: unknown[] = []
|
|
55
|
+
const guestUser = {
|
|
56
|
+
type: 'guest' as const,
|
|
57
|
+
id: 'guest-1',
|
|
58
|
+
name: 'Guest',
|
|
59
|
+
} as MessagingUser
|
|
54
60
|
|
|
55
61
|
render(
|
|
56
62
|
<MessagingProvider
|
|
57
63
|
apiKey="mock-api-key"
|
|
58
|
-
user={
|
|
64
|
+
user={guestUser}
|
|
59
65
|
serviceConfig={{
|
|
66
|
+
fetchToken: async () => 'token',
|
|
60
67
|
createChannel: async () => ({ channelId: 'ch-1' }),
|
|
61
68
|
}}
|
|
62
69
|
>
|
|
@@ -65,11 +72,7 @@ describe('MessagingProvider', () => {
|
|
|
65
72
|
)
|
|
66
73
|
|
|
67
74
|
await waitFor(() => expect(connectUser).toHaveBeenCalledTimes(1))
|
|
68
|
-
expect(connectUser).toHaveBeenCalledWith(
|
|
69
|
-
type: 'guest',
|
|
70
|
-
id: 'guest-1',
|
|
71
|
-
name: 'Guest',
|
|
72
|
-
})
|
|
75
|
+
expect(connectUser).toHaveBeenCalledWith(guestUser)
|
|
73
76
|
|
|
74
77
|
await waitFor(() => {
|
|
75
78
|
const last = states[states.length - 1] as { isConnected: boolean }
|
|
@@ -84,7 +87,7 @@ describe('MessagingProvider', () => {
|
|
|
84
87
|
type: 'guest' as const,
|
|
85
88
|
id: 'guest-1',
|
|
86
89
|
name: 'Guest',
|
|
87
|
-
}
|
|
90
|
+
} as MessagingUser
|
|
88
91
|
const authedUser = { id: 'user-1', name: 'Authed User' }
|
|
89
92
|
|
|
90
93
|
const { rerender } = render(
|
|
@@ -93,6 +96,7 @@ describe('MessagingProvider', () => {
|
|
|
93
96
|
apiKey="mock-api-key"
|
|
94
97
|
user={guestUser}
|
|
95
98
|
serviceConfig={{
|
|
99
|
+
fetchToken: async () => 'token',
|
|
96
100
|
createChannel: async () => ({ channelId: 'ch-1' }),
|
|
97
101
|
}}
|
|
98
102
|
>
|