@planningcenter/chat-react-native 4.8.0-rc.5 → 4.8.0-rc.6

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.
Files changed (37) hide show
  1. package/package.json +2 -2
  2. package/src/__tests__/contexts/session_context.tsx +2 -83
  3. package/src/__tests__/hooks/useTheme.tsx +0 -7
  4. package/src/__tests__/hooks/use_async_storage.test.tsx +1 -87
  5. package/src/__tests__/hooks/use_attachment_uploader.test.tsx +0 -11
  6. package/src/__tests__/hooks/use_font_scale.test.ts +0 -25
  7. package/src/__tests__/utils/cache/page_mutations.ts +3 -68
  8. package/src/__tests__/utils/client.ts +6 -15
  9. package/src/__tests__/utils/native_adapters/configuration.ts +15 -50
  10. package/src/__tests__/utils/parse_simple_markdown.ts +0 -6
  11. package/src/__tests__/utils/session.ts +0 -11
  12. package/src/__tests__/utils/theme.ts +0 -17
  13. package/src/components/conversations/__tests__/conversations.test.tsx +4 -1
  14. package/src/components/display/__tests__/filter_dropdown.test.tsx +1 -19
  15. package/src/components/page/__tests__/component_error_boundary.test.tsx +0 -12
  16. package/src/hooks/__tests__/jolt_refresh_throttling.test.tsx +0 -35
  17. package/src/screens/__tests__/conversation_details_screen.test.tsx +0 -19
  18. package/src/screens/avatar_picker/__tests__/avatar_picker_state.test.ts +0 -14
  19. package/src/screens/conversations/__tests__/conversations_screen.test.tsx +0 -6
  20. package/src/screens/conversations/components/__tests__/filter_dropdown_list_header_component.test.tsx +0 -8
  21. package/src/screens/conversations/components/__tests__/search_list_header_component.test.tsx +0 -10
  22. package/src/screens/search/components/__tests__/search_results_list.test.tsx +1 -0
  23. package/src/utils/__tests__/attachment_kind.test.ts +0 -4
  24. package/src/utils/__tests__/convert_attachments_for_create.test.ts +0 -28
  25. package/src/utils/__tests__/is_input_editable.test.ts +1 -2
  26. package/src/utils/__tests__/message_text.test.ts +0 -5
  27. package/src/utils/__tests__/session_manager.test.ts +0 -83
  28. package/src/utils/__tests__/sha_256.test.ts +0 -34
  29. package/src/utils/__tests__/uri.test.ts +51 -0
  30. package/src/__tests__/event-polyfill.test.ts +0 -313
  31. package/src/__tests__/index.tsx +0 -5
  32. package/src/__tests__/jest.ts +0 -11
  33. package/src/__tests__/utils/uri.ts +0 -65
  34. package/src/components/display/__tests__/icon_tile.test.tsx +0 -16
  35. package/src/components/display/__tests__/version_footer.test.tsx +0 -48
  36. package/src/screens/search/components/__tests__/search_blank_states.test.tsx +0 -20
  37. package/src/utils/__tests__/membership_sync_info_text.test.ts +0 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planningcenter/chat-react-native",
3
- "version": "4.8.0-rc.5",
3
+ "version": "4.8.0-rc.6",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -84,5 +84,5 @@
84
84
  "sf-symbols-typescript": "^2.2.0",
85
85
  "typescript": "~6.0.3"
86
86
  },
87
- "gitHead": "1bb77ffb5dde7cee28f4b32796f825fc440f4ec3"
87
+ "gitHead": "c830aa9f87e65eed31b848b8db0b6a0c07eb2b07"
88
88
  }
@@ -131,20 +131,6 @@ describe('SessionContextProvider', () => {
131
131
  expect(result.current.env).toBe('production')
132
132
  expect(result.current.token).toBeUndefined()
133
133
  })
134
-
135
- it('should use custom default environment', async () => {
136
- // Note: defaultEnv is not currently used in the implementation
137
- // This test verifies the current behavior (defaults to 'production')
138
- const config = createConfig({ defaultEnv: 'staging' })
139
- const { result } = renderHook(() => useSessionContext(), {
140
- wrapper: createWrapper(config),
141
- })
142
-
143
- await waitForQuery()
144
-
145
- // Currently defaults to 'production' regardless of defaultEnv config
146
- expect(result.current.env).toBe('production')
147
- })
148
134
  })
149
135
 
150
136
  describe('logout', () => {
@@ -182,23 +168,8 @@ describe('SessionContextProvider', () => {
182
168
  await waitForQuery() // Extra wait for async operations
183
169
 
184
170
  expect(mockOnLogout).toHaveBeenCalledTimes(1)
185
- })
186
-
187
- it('should clear query clients on logout', async () => {
188
- const config = createConfig()
189
- const { result } = renderHook(() => useSessionContext(), {
190
- wrapper: createWrapper(config),
191
- })
192
-
193
- await waitForQuery()
194
-
195
- // Note: We can't spy on the queryClient since it's created inside createWrapper
196
- // But we can verify logout was called
197
- await act(async () => {
198
- await result.current.logout()
199
- })
200
-
201
- expect(mockOnLogout).toHaveBeenCalled()
171
+ const storedValue = await mockSecureStorage.getItem(TEST_SESSIONS_KEY)
172
+ expect(SessionManager.hydrate(JSON.parse(storedValue!)).sessions).toEqual({})
202
173
  })
203
174
  })
204
175
 
@@ -256,58 +227,6 @@ describe('SessionContextProvider', () => {
256
227
  })
257
228
  })
258
229
 
259
- it('should handle multiple unauthorized responses', async () => {
260
- const token: OAuthToken = {
261
- access_token: 'old-token-12345678',
262
- refresh_token: 'refresh-token',
263
- expires_in: 3600,
264
- token_type: 'Bearer',
265
- scope: 'read write',
266
- created_at: Date.now(),
267
- }
268
-
269
- const newToken: OAuthToken = {
270
- access_token: 'new-token-87654321',
271
- refresh_token: 'new-refresh-token',
272
- expires_in: 3600,
273
- token_type: 'Bearer',
274
- scope: 'read write',
275
- created_at: Date.now(),
276
- }
277
-
278
- mockRefreshTokenFn.mockResolvedValue(newToken)
279
-
280
- const session = new Session({ env: 'production', token })
281
- const manager = new SessionManager()
282
- manager.upsertSession(session)
283
- await mockSecureStorage.setItem(TEST_SESSIONS_KEY, JSON.stringify(manager.toString()))
284
-
285
- const config = createConfig()
286
- const { result } = renderHook(() => useSessionContext(), {
287
- wrapper: createWrapper(config),
288
- })
289
-
290
- await waitForQuery()
291
-
292
- expect(result.current.token).toBeDefined()
293
-
294
- const failedResponse: FailedResponse = {
295
- status: 401,
296
- statusText: 'Unauthorized',
297
- errors: [{ detail: 'other-error', title: 'Unauthorized', status: '401' }],
298
- } as FailedResponse
299
-
300
- // Call handleUnauthorizedResponse - should trigger refresh
301
- await act(async () => {
302
- result.current.handleUnauthorizedResponse(failedResponse)
303
- })
304
-
305
- await waitForQuery()
306
-
307
- // Verify refresh was called
308
- expect(mockRefreshTokenFn).toHaveBeenCalled()
309
- })
310
-
311
230
  it('should logout on forced logout error (capuchin)', async () => {
312
231
  const token: OAuthToken = {
313
232
  access_token: 'old-token-12345678',
@@ -55,13 +55,6 @@ const Wrapper = ({ children }: { children: React.ReactNode }) => {
55
55
  )
56
56
  }
57
57
 
58
- test('should use theme', () => {
59
- themeProps = {}
60
- const { result } = renderHook(() => useTheme(), { wrapper: Wrapper })
61
-
62
- expect(result.current).toBeDefined()
63
- })
64
-
65
58
  describe('configurable theme', () => {
66
59
  test('should not error is theme is undefined', () => {
67
60
  //@ts-expect-error
@@ -71,6 +71,7 @@ describe('useAsyncStorage', () => {
71
71
 
72
72
  expect(result.current).toBeDefined()
73
73
  expect(result.current[0]).toEqual(storedValue)
74
+ expect(mockAsyncStorage.getItem).toHaveBeenCalledWith('test-key')
74
75
  })
75
76
 
76
77
  it('returns raw string value when JSON parsing fails', async () => {
@@ -99,22 +100,6 @@ describe('useAsyncStorage', () => {
99
100
  expect(result.current).toBeDefined()
100
101
  expect(result.current[0]).toBe('initial-value')
101
102
  })
102
-
103
- it('returns initial value when getItem throws quota exceeded error', async () => {
104
- const quotaError = new Error('database or disk is full (code 13): SQLITE_FULL')
105
- mockAsyncStorage.getItem.mockRejectedValue(quotaError)
106
-
107
- const { result } = renderHook(() => useAsyncStorage('test-key', 'initial-value'), {
108
- wrapper: createWrapper(),
109
- })
110
-
111
- await act(async () => {
112
- await waitForQuery()
113
- })
114
-
115
- expect(result.current).toBeDefined()
116
- expect(result.current[0]).toBe('initial-value')
117
- })
118
103
  })
119
104
 
120
105
  describe('setValue', () => {
@@ -136,23 +121,6 @@ describe('useAsyncStorage', () => {
136
121
  expect(mockAsyncStorage.setItem).toHaveBeenCalledWith('test-key', JSON.stringify(newValue))
137
122
  })
138
123
 
139
- it('saves object value to storage', async () => {
140
- const { result } = renderHook(() => useAsyncStorage('test-key', { initial: 'value' }), {
141
- wrapper: createWrapper(),
142
- })
143
-
144
- await waitForQuery()
145
-
146
- expect(result.current).toBeDefined()
147
-
148
- const newValue = { initial: 'new-value', data: 'test' }
149
- await act(async () => {
150
- await result.current[1](newValue)
151
- })
152
-
153
- expect(mockAsyncStorage.setItem).toHaveBeenCalledWith('test-key', JSON.stringify(newValue))
154
- })
155
-
156
124
  it('removes item when value is null', async () => {
157
125
  mockAsyncStorage.getItem.mockResolvedValue(JSON.stringify({ data: 'existing' }))
158
126
 
@@ -230,27 +198,6 @@ describe('useAsyncStorage', () => {
230
198
  })
231
199
  })
232
200
 
233
- it('does not throw error when setItem throws other errors by default', async () => {
234
- const error = new Error('Storage write failed')
235
- mockAsyncStorage.setItem.mockRejectedValue(error)
236
-
237
- const { result } = renderHook(() => useAsyncStorage('test-key', 'initial'), {
238
- wrapper: createWrapper(),
239
- })
240
-
241
- await waitForQuery()
242
-
243
- expect(result.current).toBeDefined()
244
- expect(result.current[0]).toBe('initial')
245
-
246
- // Should not throw - errors are caught by default
247
- let promiseResult: void | undefined
248
- await act(async () => {
249
- promiseResult = await result.current[1]('new-value')
250
- })
251
- expect(promiseResult).toBeUndefined()
252
- })
253
-
254
201
  it('does not throw error when removeItem throws an error by default', async () => {
255
202
  const error = new Error('Remove failed')
256
203
  mockAsyncStorage.removeItem.mockRejectedValue(error)
@@ -272,37 +219,4 @@ describe('useAsyncStorage', () => {
272
219
  expect(promiseResult).toBeUndefined()
273
220
  })
274
221
  })
275
-
276
- describe('edge cases', () => {
277
- it('handles complex nested objects', async () => {
278
- const complexValue = {
279
- nested: {
280
- array: [1, 2, { deep: 'value' }],
281
- date: '2024-01-01',
282
- },
283
- }
284
- mockAsyncStorage.getItem.mockResolvedValue(JSON.stringify(complexValue))
285
-
286
- const { result } = renderHook(() => useAsyncStorage('test-key', {}), {
287
- wrapper: createWrapper(),
288
- })
289
-
290
- await waitForQuery()
291
-
292
- expect(result.current).toBeDefined()
293
- expect(result.current[0]).toEqual(complexValue)
294
- })
295
-
296
- it('uses correct cache key format', async () => {
297
- const { result } = renderHook(() => useAsyncStorage('my-unique-key', 'value'), {
298
- wrapper: createWrapper(),
299
- })
300
-
301
- await waitForQuery()
302
-
303
- expect(result.current).toBeDefined()
304
- expect(result.current[0]).toBe('value')
305
- expect(mockAsyncStorage.getItem).toHaveBeenCalledWith('my-unique-key')
306
- })
307
- })
308
222
  })
@@ -126,17 +126,6 @@ describe('useAttachmentUploader', () => {
126
126
  expect(result.current.attachments).toHaveLength(0)
127
127
  })
128
128
 
129
- it('formats an integer MB limit without a trailing decimal', () => {
130
- setChatConfiguration({ maxFileSizeInBytes: 25 * 1024 * 1024 })
131
- const { result } = renderUploader()
132
-
133
- act(() => {
134
- result.current.handleFilesAttached([makeFile({ size: 25 * 1024 * 1024 + 1 })])
135
- })
136
-
137
- expect(result.current.errorMessage).toBe('File size exceeds 25 MB')
138
- })
139
-
140
129
  it('formats a fractional MB limit to one decimal', () => {
141
130
  // 50.5 MB — server could in principle return a non-multiple-of-MB cap.
142
131
  setChatConfiguration({ maxFileSizeInBytes: Math.round(50.5 * 1024 * 1024) })
@@ -41,29 +41,4 @@ describe('useFontScale', () => {
41
41
  expect(result.current).toBe(2)
42
42
  })
43
43
  })
44
-
45
- describe('with both constraints', () => {
46
- test('returns native scale when within bounds', () => {
47
- const { result } = renderHook(() =>
48
- useFontScale({ minFontSizeMultiplier: 0.5, maxFontSizeMultiplier: 2 })
49
- )
50
- expect(result.current).toBe(DEFAULT_NATIVE_FONT_SCALE)
51
- })
52
-
53
- test('clamps to minimum when native scale is below', () => {
54
- mockUseWindowDimensions.mockReturnValue({ fontScale: SMALL_NATIVE_FONT_SCALE })
55
- const { result } = renderHook(() =>
56
- useFontScale({ minFontSizeMultiplier: 1, maxFontSizeMultiplier: 2 })
57
- )
58
- expect(result.current).toBe(1)
59
- })
60
-
61
- test('clamps to maximum when native scale exceeds', () => {
62
- mockUseWindowDimensions.mockReturnValue({ fontScale: LARGE_NATIVE_FONT_SCALE })
63
- const { result } = renderHook(() =>
64
- useFontScale({ minFontSizeMultiplier: 1, maxFontSizeMultiplier: 2 })
65
- )
66
- expect(result.current).toBe(2)
67
- })
68
- })
69
44
  })
@@ -127,75 +127,8 @@ describe('updateOrCreateRecordInPagesData', () => {
127
127
  ],
128
128
  })
129
129
  })
130
- })
131
-
132
- describe('updateOrCreateRecordInPagesData function', () => {
133
- it('should update the record in the pages data', () => {
134
- const id = '3'
135
- const record = createRecord({ id })
136
- const result = updateOrCreateRecordInPagesData({ data, record })
137
-
138
- expect(result).toEqual({
139
- pageParams: {},
140
- pages: [
141
- {
142
- data: [
143
- { id: '1', type: 'Message', text: 'message 1' },
144
- { id: '2', type: 'Message', text: 'message 2' },
145
- ],
146
- included: [],
147
- links: {},
148
- meta: { count: 2, totalCount: 2 },
149
- },
150
- {
151
- data: [
152
- { id: '3', type: 'Message', text: 'example 3' },
153
- { id: '4', type: 'Message', text: 'message 4' },
154
- ],
155
- included: [],
156
- links: {},
157
- meta: { count: 2, totalCount: 2 },
158
- },
159
- ],
160
- })
161
- })
162
130
 
163
- it('should update the record in the pages data with a custom processRecord function', () => {
164
- const id = '2'
165
- const record = createRecord({ id })
166
-
167
- const result = updateOrCreateRecordInPagesData<typeof record>({
168
- data,
169
- record,
170
- processRecord: r => ({ ...r, text: 'updated ' + r.text }),
171
- })
172
-
173
- expect(result).toEqual({
174
- pageParams: {},
175
- pages: [
176
- {
177
- data: [
178
- { id: '1', type: 'Message', text: 'message 1' },
179
- { id, type: 'Message', text: `updated example ${id}` },
180
- ],
181
- included: [],
182
- links: {},
183
- meta: { count: 2, totalCount: 2 },
184
- },
185
- {
186
- data: [
187
- { id: '3', type: 'Message', text: 'message 3' },
188
- { id: '4', type: 'Message', text: 'message 4' },
189
- ],
190
- included: [],
191
- links: {},
192
- meta: { count: 2, totalCount: 2 },
193
- },
194
- ],
195
- })
196
- })
197
-
198
- it('should add records that do not yet exist, but does not run processRecord', () => {
131
+ it('should add records that do not yet exist and run processRecord on them', () => {
199
132
  const id = '5'
200
133
  const record = createRecord({ id })
201
134
 
@@ -230,7 +163,9 @@ describe('updateOrCreateRecordInPagesData function', () => {
230
163
  ],
231
164
  })
232
165
  })
166
+ })
233
167
 
168
+ describe('updateRecordInPagesData', () => {
234
169
  it('should skip the record if it does not exist', () => {
235
170
  const id = '5'
236
171
  const record = createRecord({ id })
@@ -65,6 +65,12 @@ describe('get', () => {
65
65
  })
66
66
 
67
67
  it('respects opting out of pagination walks', async () => {
68
+ const nextUrl = APP_BASE_URL + '/records?fields%5BRecord%5D=id&per_page=1&offset=1'
69
+
70
+ MockServer.get(url, { ...DefaultFixtures.records(), links: { next: nextUrl } }, 200, {
71
+ once: true,
72
+ })
73
+
68
74
  await client.get({
69
75
  url,
70
76
  data: { fields: { Record: ['id', 'name'] }, perPage: 1, walk: false },
@@ -230,9 +236,6 @@ describe('post', () => {
230
236
  })
231
237
 
232
238
  it('uses client default headers', async () => {
233
- MockServer.post('https://api-staging.planningcenteronline.com/chat/v2/records/:id', {}, 200, {
234
- once: true,
235
- })
236
239
  await clientWithDefaultHeaders.post({
237
240
  url,
238
241
  data: { fields: { Record: 'id' } },
@@ -283,9 +286,6 @@ describe('patch', () => {
283
286
  })
284
287
 
285
288
  it('uses client default headers', async () => {
286
- MockServer.patch('https://api-staging.planningcenteronline.com/chat/v2/records/:id', {}, 200, {
287
- once: true,
288
- })
289
289
  await clientWithDefaultHeaders.patch({
290
290
  url,
291
291
  data: { fields: { Record: 'id' } },
@@ -318,15 +318,6 @@ describe('delete', () => {
318
318
  })
319
319
 
320
320
  it('uses client default headers', async () => {
321
- MockServer.delete(
322
- 'https://api-staging.planningcenteronline.com/chat/v2/records/:id',
323
- undefined,
324
- 200,
325
- {
326
- once: true,
327
- }
328
- )
329
-
330
321
  await clientWithDefaultHeaders.delete({
331
322
  url,
332
323
  headers: { 'X-Custom-Header': 'value!' },
@@ -54,10 +54,6 @@ describe('ChatAdapters', () => {
54
54
  notificationError: jest.fn(),
55
55
  })
56
56
 
57
- it('should be defined', () => {
58
- expect(ChatAdapters).toBeDefined()
59
- })
60
-
61
57
  it('should configure the clipboard', () => {
62
58
  ChatAdapters.configure({
63
59
  clipboard,
@@ -71,42 +67,30 @@ describe('ChatAdapters', () => {
71
67
  })
72
68
 
73
69
  describe('linking adapter', () => {
74
- describe('defaults', () => {
75
- it('should be configured', () => {
76
- ChatAdapters.configure({
77
- clipboard,
78
- audio,
79
- video,
80
- imagePicker,
81
- })
82
-
83
- expect(Linking).toBeDefined()
84
- expect(Linking.openURL).toBeDefined()
85
- expect(Linking.canOpenURL).toBeDefined()
86
- })
70
+ it('opens URLs through React Native Linking by default', async () => {
71
+ ChatAdapters.configure({ clipboard, audio, video, imagePicker })
87
72
 
88
- describe('openUrl', () => {
89
- Linking.openURL('https://www.google.com')
90
- expect(RNLinking.openURL).toHaveBeenCalledWith('https://www.google.com')
91
- })
73
+ await Linking.openURL('https://www.google.com')
74
+
75
+ expect(RNLinking.openURL).toHaveBeenCalledWith('https://www.google.com')
92
76
  })
93
77
 
94
- describe('Adapter is bound to Linking context', () => {
78
+ it('calls the host methods bound to React Native Linking', async () => {
79
+ const receivers: unknown[] = []
95
80
  const linking = new LinkingAdapter({
96
- openURL: async function (url: string) {
97
- expect(url).toBe('https://www.google.com')
98
- expect(this).toBe(RNLinking)
81
+ openURL: async function (this: unknown) {
82
+ receivers.push(this)
99
83
  },
100
- canOpenURL: async function (url: string) {
101
- expect(url).toBe('https://www.google.com')
102
- expect(this).toBe(RNLinking)
103
-
84
+ canOpenURL: async function (this: unknown) {
85
+ receivers.push(this)
104
86
  return true
105
87
  },
106
88
  })
107
89
 
108
- linking.openURL('https://www.google.com')
109
- linking.canOpenURL('https://www.google.com')
90
+ await linking.openURL('https://www.google.com')
91
+ await linking.canOpenURL('https://www.google.com')
92
+
93
+ expect(receivers).toEqual([RNLinking, RNLinking])
110
94
  })
111
95
  })
112
96
 
@@ -157,24 +141,5 @@ describe('ChatAdapters', () => {
157
141
 
158
142
  expect(Haptic).toEqual(haptic)
159
143
  })
160
-
161
- it('should be configured with defaults', () => {
162
- ChatAdapters.configure({
163
- clipboard,
164
- audio,
165
- video,
166
- imagePicker,
167
- })
168
-
169
- expect(Haptic).toBeDefined()
170
- expect(Haptic.impactLight).toBeDefined()
171
- expect(Haptic.impactMedium).toBeDefined()
172
- expect(Haptic.impactHeavy).toBeDefined()
173
- expect(Haptic.rigid).toBeDefined()
174
- expect(Haptic.soft).toBeDefined()
175
- expect(Haptic.notificationSuccess).toBeDefined()
176
- expect(Haptic.notificationWarning).toBeDefined()
177
- expect(Haptic.notificationError).toBeDefined()
178
- })
179
144
  })
180
145
  })
@@ -51,12 +51,6 @@ describe('parseSimpleMarkdown', () => {
51
51
  expect(result).toEqual([{ type: 'text', content: '* Item 1\n* Item 2\n* Item 3' }])
52
52
  })
53
53
 
54
- it('parses ordered lists correctly', () => {
55
- const input = '1. Item 1\n2. Item 2\n3. Item 3'
56
- const result = parseSimpleMarkdown(input)
57
- expect(result).toEqual([{ type: 'text', content: '1. Item 1\n2. Item 2\n3. Item 3' }])
58
- })
59
-
60
54
  it('handles plain text without formatting', () => {
61
55
  const input = 'Just plain text'
62
56
  const result = parseSimpleMarkdown(input)
@@ -37,17 +37,6 @@ describe('Session', () => {
37
37
  expect(hydratedSession.token).toEqual(token)
38
38
  expect(hydratedSession.isAuthenticated).toEqual(true)
39
39
  })
40
-
41
- it('should store the environment of hydrated Session instance', () => {
42
- const env = 'production'
43
- const session = new Session({ token, env })
44
-
45
- const sessionString = session.toString()
46
- const hydratedSession = Session.hydrate(sessionString)
47
- expect(hydratedSession.env).toEqual(env)
48
- expect(hydratedSession.token).toEqual(token)
49
- expect(hydratedSession.isAuthenticated).toEqual(true)
50
- })
51
40
  })
52
41
 
53
42
  describe('failure', () => {
@@ -10,10 +10,6 @@ describe('defaultTheme', () => {
10
10
  expect(defaultTheme('light').colors).toMatchObject(aliasTokensColorMap.light)
11
11
  })
12
12
 
13
- test('falls back to the light palette when colorScheme is null', () => {
14
- expect(defaultTheme(null).colors).toMatchObject(aliasTokensColorMap.light)
15
- })
16
-
17
13
  test('falls back to the light palette for React Native 0.83\'s "unspecified" variant', () => {
18
14
  // RN 0.83 added "unspecified" to ColorSchemeName. Anything that is not
19
15
  // literally "dark" should fall through to the light palette so we never
@@ -22,19 +18,6 @@ describe('defaultTheme', () => {
22
18
  })
23
19
 
24
20
  describe('chip tokens', () => {
25
- test('seeds static defaults for the non-selected chip trio in both schemes', () => {
26
- const light = defaultTheme('light').colors
27
- const dark = defaultTheme('dark').colors
28
-
29
- expect(light.borderColorChip).toBe('hsl(0, 0%, 88%)')
30
- expect(light.fillColorChip).toBe('transparent')
31
- expect(light.textColorChip).toBe('hsl(0, 0%, 45%)')
32
-
33
- expect(dark.borderColorChip).toBe('hsl(0, 0%, 24%)')
34
- expect(dark.fillColorChip).toBe('transparent')
35
- expect(dark.textColorChip).toBe('hsl(0, 0%, 68%)')
36
- })
37
-
38
21
  test('never seeds a static default for the selected chip trio', () => {
39
22
  const { colors } = defaultTheme('light')
40
23
 
@@ -58,12 +58,15 @@ describe('Conversations archived footer', () => {
58
58
 
59
59
  fireEvent.press(view.getByLabelText('View active conversations'))
60
60
 
61
- expect(mockSetParams).toHaveBeenCalledWith({
61
+ expect(mockSetParams).toHaveBeenCalledTimes(1)
62
+ expect(mockSetParams.mock.calls[0][0]).toStrictEqual({
62
63
  title: undefined,
63
64
  chat_group_graph_id: undefined,
64
65
  group_source_app_name: undefined,
65
66
  show_direct_messages: undefined,
66
67
  show_archived: undefined,
68
+ show_hidden: undefined,
69
+ show_unread: undefined,
67
70
  })
68
71
  })
69
72
 
@@ -62,7 +62,7 @@ const options = [
62
62
  { id: 'teams', label: 'Teams' },
63
63
  ]
64
64
 
65
- const renderFilterDropdown = ({ showMoreFilters }: { showMoreFilters?: boolean } = {}) => {
65
+ const renderFilterDropdown = () => {
66
66
  const onSelect = jest.fn()
67
67
  const onMoreFilters = jest.fn()
68
68
 
@@ -73,7 +73,6 @@ const renderFilterDropdown = ({ showMoreFilters }: { showMoreFilters?: boolean }
73
73
  onSelect={onSelect}
74
74
  onMoreFilters={onMoreFilters}
75
75
  triggerLabel="Groups"
76
- showMoreFilters={showMoreFilters}
77
76
  />
78
77
  )
79
78
 
@@ -81,16 +80,6 @@ const renderFilterDropdown = ({ showMoreFilters }: { showMoreFilters?: boolean }
81
80
  }
82
81
 
83
82
  describe('FilterDropdown', () => {
84
- it('hands the menu every option, the selected one checked, then More filters', () => {
85
- renderFilterDropdown()
86
-
87
- expect(screen.getByRole('button', { name: 'Groups' })).toBeTruthy()
88
- expect(
89
- screen.getAllByRole('menuitem').map(item => [item.props.accessibilityState.selected])
90
- ).toEqual([[false], [true], [false], [false]])
91
- expect(screen.getByRole('menuitem', { name: 'More filters' })).toBeTruthy()
92
- })
93
-
94
83
  it('calls onSelect with the id of the pressed option', () => {
95
84
  const { onSelect, onMoreFilters } = renderFilterDropdown()
96
85
 
@@ -100,13 +89,6 @@ describe('FilterDropdown', () => {
100
89
  expect(onMoreFilters).not.toHaveBeenCalled()
101
90
  })
102
91
 
103
- it('leaves More filters out when showMoreFilters is false', () => {
104
- renderFilterDropdown({ showMoreFilters: false })
105
-
106
- expect(screen.queryByRole('menuitem', { name: 'More filters' })).toBeNull()
107
- expect(screen.getAllByRole('menuitem')).toHaveLength(options.length)
108
- })
109
-
110
92
  it('calls onMoreFilters for the More filters action', () => {
111
93
  const { onSelect, onMoreFilters } = renderFilterDropdown()
112
94
 
@@ -1,6 +1,5 @@
1
1
  import { render } from '@testing-library/react-native'
2
2
  import React from 'react'
3
- import { Text } from 'react-native'
4
3
  import { Log } from '../../../utils/native_adapters/configuration'
5
4
  import { ComponentErrorBoundary } from '../component_error_boundary'
6
5
 
@@ -32,15 +31,4 @@ describe('ComponentErrorBoundary', () => {
32
31
  expect(toJSON()).toBeNull()
33
32
  expect(reportError.mock.calls[0][1]).toMatchObject({ scope: 'component' })
34
33
  })
35
-
36
- it('lets callers override the defaults', () => {
37
- const { getByText } = render(
38
- <ComponentErrorBoundary scope="screen" fallback={<Text>overridden</Text>}>
39
- <Boom thrown={new Error('boom')} />
40
- </ComponentErrorBoundary>
41
- )
42
-
43
- expect(getByText('overridden')).toBeTruthy()
44
- expect(reportError.mock.calls[0][1]).toMatchObject({ scope: 'screen' })
45
- })
46
34
  })