@planningcenter/chat-react-native 3.34.0-rc.1 → 3.34.0-rc.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 +2 -2
- package/src/__tests__/contexts/session_context.tsx +3 -8
- package/src/__tests__/hooks/useTheme.tsx +3 -3
- package/src/__tests__/hooks/use_async_storage.test.tsx +3 -8
- package/src/__tests__/hooks/use_attachment_uploader.test.tsx +3 -2
- package/src/__tests__/hooks/use_chat_configuration.test.tsx +3 -4
- package/src/__utils__/query_client.ts +14 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "3.34.0-rc.
|
|
3
|
+
"version": "3.34.0-rc.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"react-native-url-polyfill": "^2.0.0",
|
|
66
66
|
"typescript": "~5.9.2"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "8af0cf448992a34ad3cacc1cbbe2d9881e54efd2"
|
|
69
69
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import AsyncStorage from '@react-native-async-storage/async-storage'
|
|
2
|
-
import {
|
|
2
|
+
import { QueryClientProvider } from '@tanstack/react-query'
|
|
3
3
|
import { renderHook, act } from '@testing-library/react-hooks'
|
|
4
4
|
import React, { useContext, Suspense } from 'react'
|
|
5
|
+
import { buildTestQueryClient } from '../../__utils__/query_client'
|
|
5
6
|
import {
|
|
6
7
|
SessionContext,
|
|
7
8
|
SessionContextProvider,
|
|
@@ -67,13 +68,7 @@ const waitForQuery = async () => {
|
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
const createWrapper = (config: SessionContextConfig) => {
|
|
70
|
-
const queryClient =
|
|
71
|
-
defaultOptions: {
|
|
72
|
-
queries: {
|
|
73
|
-
retry: false,
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
})
|
|
71
|
+
const queryClient = buildTestQueryClient()
|
|
77
72
|
|
|
78
73
|
return ({ children }: { children: React.ReactNode }) => (
|
|
79
74
|
<QueryClientProvider client={queryClient}>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
2
2
|
import { renderHook } from '@testing-library/react-native'
|
|
3
3
|
import React from 'react'
|
|
4
|
+
import { buildTestQueryClient } from '../../__utils__/query_client'
|
|
4
5
|
import { ChatProvider, CreateChatThemeProps } from '../../contexts/chat_context'
|
|
5
6
|
import { useTheme } from '../../hooks'
|
|
6
7
|
|
|
@@ -14,11 +15,10 @@ let themeProps: CreateChatThemeProps = {
|
|
|
14
15
|
let queryClient: QueryClient
|
|
15
16
|
|
|
16
17
|
beforeEach(() => {
|
|
17
|
-
queryClient =
|
|
18
|
+
queryClient = buildTestQueryClient({
|
|
18
19
|
defaultOptions: {
|
|
19
20
|
queries: {
|
|
20
|
-
|
|
21
|
-
refetchInterval: false, // Disable refetch intervals in tests
|
|
21
|
+
refetchInterval: false,
|
|
22
22
|
refetchOnWindowFocus: false,
|
|
23
23
|
refetchOnReconnect: false,
|
|
24
24
|
},
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import AsyncStorage from '@react-native-async-storage/async-storage'
|
|
2
|
-
import {
|
|
2
|
+
import { QueryClientProvider } from '@tanstack/react-query'
|
|
3
3
|
import { renderHook, act } from '@testing-library/react-hooks'
|
|
4
4
|
import React, { Suspense } from 'react'
|
|
5
|
+
import { buildTestQueryClient } from '../../__utils__/query_client'
|
|
5
6
|
import { useAsyncStorage } from '../../hooks/use_async_storage'
|
|
6
7
|
|
|
7
8
|
jest.mock('@react-native-async-storage/async-storage')
|
|
@@ -14,13 +15,7 @@ afterAll(() => {
|
|
|
14
15
|
const mockAsyncStorage = AsyncStorage as jest.Mocked<typeof AsyncStorage>
|
|
15
16
|
|
|
16
17
|
const createWrapper = () => {
|
|
17
|
-
const queryClient =
|
|
18
|
-
defaultOptions: {
|
|
19
|
-
queries: {
|
|
20
|
-
retry: false,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
})
|
|
18
|
+
const queryClient = buildTestQueryClient()
|
|
24
19
|
|
|
25
20
|
return ({ children }: { children: React.ReactNode }) => (
|
|
26
21
|
<QueryClientProvider client={queryClient}>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { QueryClientProvider } from '@tanstack/react-query'
|
|
2
2
|
import { renderHook, act } from '@testing-library/react-hooks'
|
|
3
3
|
import React from 'react'
|
|
4
|
+
import { buildTestQueryClient } from '../../__utils__/query_client'
|
|
4
5
|
import { useApiClient } from '../../hooks/use_api_client'
|
|
5
6
|
import { useAttachmentUploader } from '../../hooks/use_attachment_uploader'
|
|
6
7
|
import { useChatConfiguration } from '../../hooks/use_chat_configuration'
|
|
@@ -18,7 +19,7 @@ const mockedUseChatConfiguration = useChatConfiguration as jest.MockedFunction<
|
|
|
18
19
|
>
|
|
19
20
|
|
|
20
21
|
const createWrapper = () => {
|
|
21
|
-
const queryClient =
|
|
22
|
+
const queryClient = buildTestQueryClient()
|
|
22
23
|
return ({ children }: { children: React.ReactNode }) => (
|
|
23
24
|
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
|
|
24
25
|
)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { QueryClientProvider } from '@tanstack/react-query'
|
|
2
2
|
import { renderHook, act } from '@testing-library/react-hooks'
|
|
3
3
|
import React, { Suspense } from 'react'
|
|
4
|
+
import { buildTestQueryClient } from '../../__utils__/query_client'
|
|
4
5
|
import {
|
|
5
6
|
FALLBACK_ALLOWED_FILE_EXTENSIONS,
|
|
6
7
|
FALLBACK_MAX_ATTACHMENTS_PER_MESSAGE,
|
|
@@ -10,9 +11,7 @@ import * as useApiClientModule from '../../hooks/use_api_client'
|
|
|
10
11
|
import { useChatConfiguration } from '../../hooks/use_chat_configuration'
|
|
11
12
|
|
|
12
13
|
const createWrapper = () => {
|
|
13
|
-
const queryClient =
|
|
14
|
-
defaultOptions: { queries: { retry: false } },
|
|
15
|
-
})
|
|
14
|
+
const queryClient = buildTestQueryClient()
|
|
16
15
|
|
|
17
16
|
return ({ children }: { children: React.ReactNode }) => (
|
|
18
17
|
<QueryClientProvider client={queryClient}>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { QueryClient, QueryClientConfig } from '@tanstack/react-query'
|
|
2
|
+
import { merge } from 'lodash'
|
|
3
|
+
|
|
4
|
+
const baseConfig: QueryClientConfig = {
|
|
5
|
+
defaultOptions: {
|
|
6
|
+
queries: {
|
|
7
|
+
retry: false,
|
|
8
|
+
gcTime: 0,
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const buildTestQueryClient = (overrides: QueryClientConfig = {}) =>
|
|
14
|
+
new QueryClient(merge({}, baseConfig, overrides))
|