@planningcenter/chat-react-native 4.8.0-qa-staging.8 → 4.8.0-qa-staging.9

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 (54) hide show
  1. package/build/components/primitive/banner_primitive.js +3 -7
  2. package/build/components/primitive/banner_primitive.js.map +1 -1
  3. package/build/contexts/session_context.d.ts +0 -1
  4. package/build/contexts/session_context.d.ts.map +1 -1
  5. package/build/contexts/session_context.js.map +1 -1
  6. package/build/screens/conversations/conversations_screen.d.ts.map +1 -1
  7. package/build/screens/conversations/conversations_screen.js +29 -47
  8. package/build/screens/conversations/conversations_screen.js.map +1 -1
  9. package/package.json +3 -3
  10. package/src/__tests__/contexts/session_context.tsx +19 -39
  11. package/src/__tests__/hooks/useTheme.tsx +0 -7
  12. package/src/__tests__/hooks/use_async_storage.test.tsx +1 -87
  13. package/src/__tests__/hooks/use_attachment_uploader.test.tsx +0 -11
  14. package/src/__tests__/hooks/use_font_scale.test.ts +0 -25
  15. package/src/__tests__/utils/cache/page_mutations.ts +3 -68
  16. package/src/__tests__/utils/client.ts +6 -15
  17. package/src/__tests__/utils/native_adapters/configuration.ts +15 -50
  18. package/src/__tests__/utils/parse_simple_markdown.ts +0 -6
  19. package/src/__tests__/utils/session.ts +0 -11
  20. package/src/__tests__/utils/theme.ts +0 -17
  21. package/src/components/conversations/__tests__/conversations.test.tsx +4 -1
  22. package/src/components/display/__tests__/filter_dropdown.test.tsx +1 -19
  23. package/src/components/display/__tests__/icon_tile.test.tsx +24 -7
  24. package/src/components/page/__tests__/component_error_boundary.test.tsx +0 -12
  25. package/src/components/primitive/banner_primitive.tsx +1 -5
  26. package/src/contexts/session_context.tsx +0 -1
  27. package/src/hooks/__tests__/jolt_refresh_throttling.test.tsx +0 -35
  28. package/src/screens/__tests__/conversation_details_screen.test.tsx +0 -19
  29. package/src/screens/avatar_picker/__tests__/avatar_picker_state.test.ts +0 -14
  30. package/src/screens/conversations/__tests__/conversations_screen.test.tsx +3 -8
  31. package/src/screens/conversations/components/__tests__/filter_dropdown_list_header_component.test.tsx +0 -8
  32. package/src/screens/conversations/components/__tests__/search_list_header_component.test.tsx +0 -10
  33. package/src/screens/conversations/conversations_screen.tsx +1 -9
  34. package/src/screens/search/components/__tests__/search_results_list.test.tsx +1 -0
  35. package/src/utils/__tests__/attachment_kind.test.ts +0 -4
  36. package/src/utils/__tests__/convert_attachments_for_create.test.ts +0 -28
  37. package/src/utils/__tests__/is_input_editable.test.ts +1 -2
  38. package/src/utils/__tests__/message_text.test.ts +0 -5
  39. package/src/utils/__tests__/session_manager.test.ts +0 -83
  40. package/src/utils/__tests__/sha_256.test.ts +0 -34
  41. package/src/utils/__tests__/uri.test.ts +51 -0
  42. package/build/components/conversations/app_update_banner.d.ts +0 -2
  43. package/build/components/conversations/app_update_banner.d.ts.map +0 -1
  44. package/build/components/conversations/app_update_banner.js +0 -52
  45. package/build/components/conversations/app_update_banner.js.map +0 -1
  46. package/src/__tests__/event-polyfill.test.ts +0 -313
  47. package/src/__tests__/index.tsx +0 -5
  48. package/src/__tests__/jest.ts +0 -11
  49. package/src/__tests__/utils/uri.ts +0 -65
  50. package/src/components/conversations/__tests__/app_update_banner.test.tsx +0 -27
  51. package/src/components/conversations/app_update_banner.tsx +0 -36
  52. package/src/components/display/__tests__/version_footer.test.tsx +0 -48
  53. package/src/screens/search/components/__tests__/search_blank_states.test.tsx +0 -20
  54. package/src/utils/__tests__/membership_sync_info_text.test.ts +0 -15
@@ -1,16 +1,33 @@
1
1
  import { render } from '@testing-library/react-native'
2
2
  import React from 'react'
3
+ import { StyleSheet } from 'react-native'
3
4
  import { faBoxArchive } from '../../../vendor/font_awesome_pro_solid_icons'
4
5
  import { IconTile } from '../icon_tile'
5
6
 
7
+ const clippingAncestors = (shape: 'circle' | 'square') => {
8
+ const view = render(
9
+ <IconTile icon={faBoxArchive} shape={shape} maxFontSizeMultiplier={1} testID="tile" />
10
+ )
11
+ const ancestors = []
12
+ let node = view.getByTestId('tile', { includeHiddenElements: true }).parent
13
+ while (node) {
14
+ ancestors.push(node)
15
+ node = node.parent
16
+ }
17
+
18
+ return ancestors.filter(
19
+ ancestor =>
20
+ typeof ancestor.type === 'string' &&
21
+ StyleSheet.flatten(ancestor.props.style)?.overflow === 'hidden'
22
+ )
23
+ }
24
+
6
25
  describe('IconTile', () => {
7
- it('rounds the corners of a square tile instead of masking it to a circle', () => {
8
- const view = render(
9
- <IconTile icon={faBoxArchive} shape="square" maxFontSizeMultiplier={1} testID="tile" />
10
- )
26
+ it('masks a circle tile', () => {
27
+ expect(clippingAncestors('circle')).not.toHaveLength(0)
28
+ })
11
29
 
12
- expect(view.getByTestId('tile', { includeHiddenElements: true })).toHaveStyle({
13
- borderRadius: 4,
14
- })
30
+ it('keeps a square tile out of the circular mask', () => {
31
+ expect(clippingAncestors('square')).toHaveLength(0)
15
32
  })
16
33
  })
@@ -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
  })
@@ -249,7 +249,7 @@ function BannerLink({ children, onPress }: BannerLinkProps) {
249
249
  const styles = useStyles({ appearance })
250
250
 
251
251
  return (
252
- <TextInlineButton variant="tertiary" style={styles.link} onPress={onPress}>
252
+ <TextInlineButton variant="tertiary" style={styles.text} onPress={onPress}>
253
253
  {children}
254
254
  </TextInlineButton>
255
255
  )
@@ -295,9 +295,5 @@ const useStyles = ({ appearance = 'neutral' }: Styles = {}) => {
295
295
  text: {
296
296
  color: statusColorMap[appearance].text,
297
297
  },
298
- link: {
299
- color: statusColorMap[appearance].text,
300
- textDecorationColor: statusColorMap[appearance].text,
301
- },
302
298
  })
303
299
  }
@@ -71,7 +71,6 @@ export type SessionContextConfig = {
71
71
  retryText?: string
72
72
  logoutText?: string
73
73
  }
74
- defaultEnv?: ENV
75
74
  }
76
75
 
77
76
  const decorateSession = async <T extends PartialToken>(session: Session<T>) => {
@@ -155,41 +155,6 @@ describe('conversation.updated across two lists and two screens', () => {
155
155
  expect(requestsFor(listUrl)).toBe(2)
156
156
  expect(requestsFor(conversationUrl)).toBe(2)
157
157
  })
158
-
159
- it('refreshes immediately for a lone event and makes no second request', async () => {
160
- conversationUpdated()
161
- await advance(1)
162
-
163
- expect(requestsFor(listUrl)).toBe(1)
164
- expect(requestsFor(conversationUrl)).toBe(1)
165
-
166
- await advance(REFRESH_THROTTLE_MS * 2)
167
-
168
- expect(requestsFor(listUrl)).toBe(1)
169
- expect(requestsFor(conversationUrl)).toBe(1)
170
- })
171
-
172
- it('gives an event inside the window a trailing refresh opened its own trailing refresh', async () => {
173
- conversationUpdated()
174
- await advance(1000)
175
- conversationUpdated()
176
- await advance(REFRESH_THROTTLE_MS - 1000)
177
-
178
- expect(requestsFor(listUrl)).toBe(2)
179
- expect(requestsFor(conversationUrl)).toBe(2)
180
-
181
- await advance(500)
182
- conversationUpdated()
183
- await advance(1)
184
-
185
- expect(requestsFor(listUrl)).toBe(2)
186
- expect(requestsFor(conversationUrl)).toBe(2)
187
-
188
- await advance(REFRESH_THROTTLE_MS)
189
-
190
- expect(requestsFor(listUrl)).toBe(3)
191
- expect(requestsFor(conversationUrl)).toBe(3)
192
- })
193
158
  })
194
159
 
195
160
  describe('/me refreshes', () => {
@@ -257,16 +257,6 @@ describe('ConversationDetailsScreen archive', () => {
257
257
  expect(queryByText('Archive conversation…')).toBeNull()
258
258
  })
259
259
 
260
- it.each(['QA_MOBILE_manual_archiving', 'ROLLOUT_MOBILE_manual_archiving'])(
261
- 'offers archiving with only %s on',
262
- flag => {
263
- mockEnabledFeatures = [flag]
264
- const { getByText } = renderScreen()
265
-
266
- expect(getByText('Archive conversation…')).toBeTruthy()
267
- }
268
- )
269
-
270
260
  it('hides archiving when neither mobile flag is on', () => {
271
261
  mockEnabledFeatures = ['ROLLOUT_WEB_manual_archiving']
272
262
  const { queryByText } = renderScreen()
@@ -299,15 +289,6 @@ describe('ConversationDetailsScreen archive', () => {
299
289
  expect(mockNavigation.goBack).not.toHaveBeenCalled()
300
290
  expect(mockNavigation.navigate).not.toHaveBeenCalled()
301
291
  })
302
-
303
- it('does nothing when the confirmation is cancelled', () => {
304
- const { getByText } = renderScreen()
305
- fireEvent.press(getByText('Archive conversation…'))
306
-
307
- alertButton('Cancel')?.onPress?.()
308
-
309
- expect(mockArchive).not.toHaveBeenCalled()
310
- })
311
292
  })
312
293
 
313
294
  describe('ConversationDetailsScreen hide', () => {
@@ -10,20 +10,6 @@ import {
10
10
 
11
11
  const emptyState = initEmptyAvatarPickerState()
12
12
 
13
- describe('initEmptyAvatarPickerState', () => {
14
- it('starts clean', () => {
15
- expect(emptyState).toMatchObject({
16
- activeTab: 'icon',
17
- selectedType: null,
18
- selectedKey: null,
19
- selectedColor: DEFAULT_AVATAR_COLOR_KEY,
20
- imagePreviewUri: null,
21
- imageAsset: null,
22
- isDirty: false,
23
- })
24
- })
25
- })
26
-
27
13
  describe('initAvatarPickerState', () => {
28
14
  it('seeds from icon avatar', () => {
29
15
  const conversation = {
@@ -34,8 +34,9 @@ jest.mock('../../../contexts/conversations_context', () => ({
34
34
  }),
35
35
  }))
36
36
  jest.mock('../../../components', () => ({
37
- Conversations: ({ ListHeaderComponent }: { ListHeaderComponent: React.ReactElement }) =>
38
- ListHeaderComponent,
37
+ Conversations: ({ ListHeaderComponent }: { ListHeaderComponent: React.ComponentType }) => (
38
+ <ListHeaderComponent />
39
+ ),
39
40
  }))
40
41
  jest.mock('../../../components/display/toast', () => ({ Toast: () => null }))
41
42
  jest.mock('../../../components/conversations/bulk_conversation_actions_bar', () => ({
@@ -116,12 +117,6 @@ describe('ConversationsScreen header gating', () => {
116
117
  expect(await view.findByText('Filter dropdown header')).toBeTruthy()
117
118
  })
118
119
 
119
- it('shows the filter dropdown header with only its rollout flag on', async () => {
120
- const view = renderWithFeatures(['ROLLOUT_MOBILE_filter_dropdown'])
121
-
122
- expect(await view.findByText('Filter dropdown header')).toBeTruthy()
123
- })
124
-
125
120
  it('shows the default header with neither flag on', async () => {
126
121
  const view = renderWithFeatures(['ROLLOUT_WEB_search'])
127
122
 
@@ -326,14 +326,6 @@ describe('FilterDropdownListHeaderComponent', () => {
326
326
  )
327
327
  })
328
328
 
329
- it('More filters opens the filters sheet', () => {
330
- render(<FilterDropdownListHeaderComponent />)
331
-
332
- fireEvent.press(screen.getByRole('menuitem', { name: 'More filters' }))
333
-
334
- expect(mockNavigate).toHaveBeenCalledWith('ConversationFilters', expect.any(Object))
335
- })
336
-
337
329
  it('More filters carries the Unread filter into the sheet', () => {
338
330
  setRouteParams({ show_unread: true })
339
331
 
@@ -49,14 +49,4 @@ describe('SearchListHeaderComponent search button', () => {
49
49
  expect(mockNavigate).toHaveBeenCalledTimes(1)
50
50
  expect(mockNavigate).toHaveBeenCalledWith('Search')
51
51
  })
52
-
53
- it('renders the search button after the other actions', () => {
54
- const view = render(<SearchListHeaderComponent />)
55
-
56
- const buttons = view.getAllByRole('button').map(button => button.props.accessibilityLabel)
57
-
58
- expect(buttons.indexOf('Search')).toBeGreaterThanOrEqual(0)
59
- expect(buttons.indexOf('Search')).toBeGreaterThan(buttons.indexOf('Chat settings'))
60
- expect(buttons.indexOf('Search')).toBeGreaterThan(buttons.indexOf('New conversation'))
61
- })
62
52
  })
@@ -2,7 +2,6 @@ import { StaticScreenProps, useNavigation } from '@react-navigation/native'
2
2
  import React, { useEffect, useLayoutEffect, useRef } from 'react'
3
3
  import { StyleSheet, View } from 'react-native'
4
4
  import { Conversations } from '../../components'
5
- import { AppUpdateBanner } from '../../components/conversations/app_update_banner'
6
5
  import { BulkConversationActionsBar } from '../../components/conversations/bulk_conversation_actions_bar'
7
6
  import {
8
7
  composeOptions,
@@ -57,14 +56,7 @@ export function ConversationsScreen({ route }: ConversationsScreenProps) {
57
56
  <ConversationsContextProvider args={route.params} opts={{ throwOnError: true }}>
58
57
  <SelectModeHeader title={route.params?.title} />
59
58
  <SelectModeRequest conversationId={route.params?.select_conversation_id} />
60
- <Conversations
61
- ListHeaderComponent={
62
- <>
63
- <Header />
64
- <AppUpdateBanner />
65
- </>
66
- }
67
- />
59
+ <Conversations ListHeaderComponent={Header} />
68
60
  <BulkConversationActionsBar />
69
61
  </ConversationsContextProvider>
70
62
  <Toast />
@@ -81,6 +81,7 @@ describe('SearchResultsList', () => {
81
81
  it('shows the no-results state with the term when nothing matches', () => {
82
82
  const view = renderList({})
83
83
 
84
+ expect(view.getByText('No results')).toBeTruthy()
84
85
  expect(view.getByText(/Nothing matches “potluck\.”/)).toBeTruthy()
85
86
  })
86
87
 
@@ -4,12 +4,8 @@ describe('pickAttachmentPreviewKind', () => {
4
4
  describe('with a usable MIME type', () => {
5
5
  it.each([
6
6
  ['image/png', 'image'],
7
- ['image/jpeg', 'image'],
8
7
  ['video/mp4', 'video'],
9
- ['video/quicktime', 'video'],
10
8
  ['application/pdf', 'file'],
11
- ['text/plain', 'file'],
12
- ['application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'file'],
13
9
  ['', 'file'],
14
10
  [undefined, 'file'],
15
11
  ])('classifies %p as %p', (input, expected) => {
@@ -144,32 +144,4 @@ describe('convertAttachmentsForCreate', () => {
144
144
  expect(result).toHaveLength(1)
145
145
  expect(result[0]).toEqual(expandedLinkAttachment)
146
146
  })
147
-
148
- it('converts mixed attachment types correctly', () => {
149
- const messageAttachment: DenormalizedMessageAttachmentResourceForCreate = {
150
- type: 'MessageAttachment',
151
- id: 'msg-id',
152
- file: {
153
- uri: 'file://test.jpg',
154
- name: 'test.jpg',
155
- type: 'image/jpeg',
156
- size: 1024,
157
- },
158
- }
159
-
160
- const expandedLinkAttachment: DenormalizedExpandedLinkAttachmentResource = {
161
- type: 'ExpandedLink',
162
- attributes: {
163
- url: 'https://example.com',
164
- title: 'Example Link',
165
- },
166
- }
167
-
168
- const result = convertAttachmentsForCreate([messageAttachment, expandedLinkAttachment])
169
-
170
- expect(result).toHaveLength(2)
171
- expect(result[0].type).toBe('MessageAttachment')
172
- expect(result[1].type).toBe('ExpandedLink')
173
- expect(result[1]).toEqual(expandedLinkAttachment)
174
- })
175
147
  })
@@ -7,8 +7,7 @@ const base = {
7
7
 
8
8
  describe('isInputEditable', () => {
9
9
  it.each([
10
- ['active conversation with no text', base, true],
11
- ['active conversation with text', base, true],
10
+ ['active conversation', base, true],
12
11
  ['pending request locks input', { ...base, isPending: true }, false],
13
12
  ['disabled conversation locks input', { ...base, conversationDisabled: true }, false],
14
13
  ])('%s', (_label, args, expected) => {
@@ -37,9 +37,4 @@ describe('hasMessageText', () => {
37
37
  ])('%s -> %s', (_name, input, expected) => {
38
38
  expect(hasMessageText(input)).toBe(expected)
39
39
  })
40
-
41
- it('is not fooled by trim alone, which does not treat the character as whitespace', () => {
42
- expect(EMPTY.trim()).toBe(EMPTY)
43
- expect(hasMessageText(EMPTY)).toBe(false)
44
- })
45
40
  })
@@ -35,30 +35,9 @@ describe('SessionManager', () => {
35
35
  expect(manager.sessions).toEqual({})
36
36
  expect(manager.currentSession.isAuthenticated).toBe(false)
37
37
  })
38
-
39
- it('should return a default SessionManager when given empty string', () => {
40
- const manager = SessionManager.hydrate('')
41
-
42
- expect(manager.currentSessionId).toBe(UNAUTHENTICATED_SESSION_ID)
43
- expect(manager.sessions).toEqual({})
44
- })
45
38
  })
46
39
 
47
40
  describe('currentSession', () => {
48
- it('should return the current session when it exists', () => {
49
- const session = new Session({ token: createToken('token-12345678') })
50
- const managerString = JSON.stringify({
51
- sessions: { '12345678': session.toString() },
52
- currentSessionId: '12345678',
53
- })
54
- const manager = SessionManager.hydrate(managerString)
55
-
56
- const currentSession = manager.currentSession
57
-
58
- expect(currentSession.isAuthenticated).toBe(true)
59
- expect(currentSession.token?.access_token).toBe('token-12345678')
60
- })
61
-
62
41
  it('should return an unauthenticated session when currentSessionId does not exist', () => {
63
42
  const managerString = JSON.stringify({
64
43
  sessions: {},
@@ -71,17 +50,6 @@ describe('SessionManager', () => {
71
50
  expect(currentSession.isAuthenticated).toBe(false)
72
51
  expect(currentSession.id).toBe(UNAUTHENTICATED_SESSION_ID)
73
52
  })
74
-
75
- it('should return an unauthenticated session when currentSessionId is unauthenticated', () => {
76
- const manager = SessionManager.hydrate(
77
- JSON.stringify({ sessions: {}, currentSessionId: UNAUTHENTICATED_SESSION_ID })
78
- )
79
-
80
- const currentSession = manager.currentSession
81
-
82
- expect(currentSession.isAuthenticated).toBe(false)
83
- expect(currentSession.id).toBe(UNAUTHENTICATED_SESSION_ID)
84
- })
85
53
  })
86
54
 
87
55
  describe('setEnv', () => {
@@ -153,17 +121,6 @@ describe('SessionManager', () => {
153
121
  expect(manager.currentSession.env).toBe('staging')
154
122
  expect(manager.currentSessionId).toBe('12345678')
155
123
  })
156
-
157
- it('should update currentSessionId to match the session ID', () => {
158
- const manager = SessionManager.hydrate(
159
- JSON.stringify({ sessions: {}, currentSessionId: UNAUTHENTICATED_SESSION_ID })
160
- )
161
- const session = new Session({ token: createToken('token-11111111') })
162
-
163
- manager.upsertSession(session)
164
-
165
- expect(manager.currentSessionId).toBe('11111111')
166
- })
167
124
  })
168
125
 
169
126
  describe('removeSession', () => {
@@ -216,17 +173,6 @@ describe('SessionManager', () => {
216
173
  expect(manager.currentSessionId).toBe('11111111')
217
174
  expect(manager.sessions).not.toHaveProperty('22222222')
218
175
  })
219
-
220
- it('should handle removing unauthenticated session gracefully', () => {
221
- const manager = SessionManager.hydrate(
222
- JSON.stringify({ sessions: {}, currentSessionId: UNAUTHENTICATED_SESSION_ID })
223
- )
224
-
225
- manager.removeSession(UNAUTHENTICATED_SESSION_ID)
226
-
227
- expect(manager.currentSessionId).toBe(UNAUTHENTICATED_SESSION_ID)
228
- expect(manager.sessions).not.toHaveProperty(UNAUTHENTICATED_SESSION_ID)
229
- })
230
176
  })
231
177
 
232
178
  describe('updateCurrentToken', () => {
@@ -244,20 +190,6 @@ describe('SessionManager', () => {
244
190
 
245
191
  expect(manager.currentSession.token?.access_token).toBe('token-22222222')
246
192
  expect(manager.currentSessionId).toBe('22222222')
247
- })
248
-
249
- it('should remove the old session when token changes', () => {
250
- const oldToken = createToken('token-11111111')
251
- const session = new Session({ token: oldToken })
252
- const managerString = JSON.stringify({
253
- sessions: { '11111111': session.toString() },
254
- currentSessionId: '11111111',
255
- })
256
- const manager = SessionManager.hydrate(managerString)
257
- const newToken = createToken('token-22222222')
258
-
259
- manager.updateCurrentToken(newToken)
260
-
261
193
  expect(manager.sessions).not.toHaveProperty('11111111')
262
194
  expect(manager.sessions).toHaveProperty('22222222')
263
195
  })
@@ -292,21 +224,6 @@ describe('SessionManager', () => {
292
224
  })
293
225
 
294
226
  describe('toString', () => {
295
- it('should serialize the manager to a JSON string', () => {
296
- const session = new Session({ token: createToken('token-12345678') })
297
- const managerString = JSON.stringify({
298
- sessions: { '12345678': session.toString() },
299
- currentSessionId: '12345678',
300
- })
301
- const manager = SessionManager.hydrate(managerString)
302
-
303
- const serialized = manager.toString()
304
- const parsed = JSON.parse(serialized)
305
-
306
- expect(parsed.currentSessionId).toBe('12345678')
307
- expect(parsed.sessions).toHaveProperty('12345678')
308
- })
309
-
310
227
  it('should produce a string that can be hydrated back to the same state', () => {
311
228
  const session1 = new Session({ token: createToken('token-11111111') })
312
229
  const session2 = new Session({ token: createToken('token-22222222') })
@@ -11,11 +11,6 @@ describe('SHA256', () => {
11
11
  expect(hash).toBe('ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad')
12
12
  })
13
13
 
14
- it('computes correct hash for "The quick brown fox jumps over the lazy dog"', () => {
15
- const hash = SHA256('The quick brown fox jumps over the lazy dog').toString(enc.Hex)
16
- expect(hash).toBe('d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592')
17
- })
18
-
19
14
  it('computes correct hash for longer message', () => {
20
15
  const message = 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq'
21
16
  const hash = SHA256(message).toString(enc.Hex)
@@ -34,37 +29,8 @@ describe('SHA256', () => {
34
29
  expect(hash).toBe('c15ee319b97bfd23fa98590baf0b47d1f7b7b81f9e5bf99d8275867e2e4a32a2')
35
30
  })
36
31
 
37
- it('computes correct hash for JSON payload', () => {
38
- const payload = JSON.stringify({ events: [{ name: 'test', meta: { foo: 'bar' } }] })
39
- const hash = SHA256(payload).toString(enc.Hex)
40
- expect(hash).toBe('5e4043aadad336890b9795ee03675a9de1a6abbc4e84f9f95daaffb21569312e')
41
- })
42
-
43
32
  it('toString without encoding parameter defaults to hex', () => {
44
33
  const hash = SHA256('abc').toString()
45
34
  expect(hash).toBe('ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad')
46
35
  })
47
-
48
- it('produces consistent results for the same input', () => {
49
- const input = 'test message'
50
- const hash1 = SHA256(input).toString(enc.Hex)
51
- const hash2 = SHA256(input).toString(enc.Hex)
52
- expect(hash1).toBe(hash2)
53
- })
54
-
55
- it('produces different hashes for different inputs', () => {
56
- const hash1 = SHA256('message 1').toString(enc.Hex)
57
- const hash2 = SHA256('message 2').toString(enc.Hex)
58
- expect(hash1).not.toBe(hash2)
59
- })
60
-
61
- it('handles strings with special characters', () => {
62
- const hash = SHA256('!@#$%^&*()_+-=[]{}|;:",.<>?/~`').toString(enc.Hex)
63
- expect(hash).toBe('67764597efaadfd3a9d89032105c9fcde16c6f05d16214e42488af193abb280a')
64
- })
65
-
66
- it('handles strings with newlines and tabs', () => {
67
- const hash = SHA256('line1\nline2\tline3').toString(enc.Hex)
68
- expect(hash).toBe('450c0302bb6c2b9d81f81c8c868f7e96e3a35bc83751a08b7da09e77c4f13eec')
69
- })
70
36
  })
@@ -24,3 +24,54 @@ describe('on a Protonova environment', () => {
24
24
  )
25
25
  })
26
26
  })
27
+
28
+ describe('baseUrl', () => {
29
+ describe('planning center', () => {
30
+ it('should return the correct base URL for production', () => {
31
+ const uri = new Uri({
32
+ session: new Session({ env: 'production', type: 'OAuth' }),
33
+ })
34
+ expect(uri.baseUrl).toBe('https://api.planningcenteronline.com')
35
+ })
36
+
37
+ it('should return the correct base URL for staging', () => {
38
+ const uri = new Uri({
39
+ session: new Session({ env: 'staging', type: 'OAuth' }),
40
+ })
41
+ expect(uri.baseUrl).toBe('https://api-staging.planningcenteronline.com')
42
+ })
43
+
44
+ it('should return the correct base URL for development', () => {
45
+ const uri = new Uri({
46
+ session: new Session({ env: 'development', type: 'OAuth' }),
47
+ })
48
+ expect(uri.baseUrl).toBe('https://api.pco.test')
49
+ })
50
+ })
51
+
52
+ describe('church center', () => {
53
+ it('should return the correct base URL for production', () => {
54
+ const uri = new Uri({
55
+ session: new Session({ env: 'production', type: 'ChurchCenterOauth' }),
56
+ graph: 'churchcenter',
57
+ })
58
+ expect(uri.baseUrl).toBe('https://api.churchcenter.com')
59
+ })
60
+
61
+ it('should return the correct base URL for staging', () => {
62
+ const uri = new Uri({
63
+ session: new Session({ env: 'staging', type: 'ChurchCenterOauth' }),
64
+ graph: 'churchcenter',
65
+ })
66
+ expect(uri.baseUrl).toBe('https://api.staging.churchcenter.com')
67
+ })
68
+
69
+ it('should return the correct base URL for development', () => {
70
+ const uri = new Uri({
71
+ session: new Session({ env: 'development', type: 'ChurchCenterOauth' }),
72
+ graph: 'churchcenter',
73
+ })
74
+ expect(uri.baseUrl).toBe('https://api.churchcenter.test')
75
+ })
76
+ })
77
+ })
@@ -1,2 +0,0 @@
1
- export declare function AppUpdateBanner(): import("react/jsx-runtime").JSX.Element | null;
2
- //# sourceMappingURL=app_update_banner.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app_update_banner.d.ts","sourceRoot":"","sources":["../../../src/components/conversations/app_update_banner.tsx"],"names":[],"mappings":"AAMA,wBAAgB,eAAe,mDAoB9B"}
@@ -1,52 +0,0 @@
1
- import { c as _c } from "react/compiler-runtime";
2
- import React from 'react';
3
- import { StyleSheet, View } from 'react-native';
4
- import { Updates } from '../../utils/native_adapters';
5
- import { Banner } from '../display/banner';
6
- import BannerPrimitive from '../primitive/banner_primitive';
7
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
- export function AppUpdateBanner() {
9
- const $ = _c(3);
10
- const styles = useStyles();
11
- const downloadedUpdateId = Updates.useDownloadedUpdateId();
12
- if (!downloadedUpdateId) {
13
- return null;
14
- }
15
- let t0;
16
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
17
- t0 = /*#__PURE__*/_jsx(Banner, {
18
- appearance: "info",
19
- heading: "Chat update available",
20
- description: /*#__PURE__*/_jsxs(BannerPrimitive.Text, {
21
- children: [/*#__PURE__*/_jsx(BannerPrimitive.Link, {
22
- onPress: Updates.restart,
23
- children: "Reload"
24
- }), " to get the latest fixes and improvements."]
25
- })
26
- });
27
- $[0] = t0;
28
- } else {
29
- t0 = $[0];
30
- }
31
- let t1;
32
- if ($[1] !== styles.container) {
33
- t1 = /*#__PURE__*/_jsx(View, {
34
- style: styles.container,
35
- children: t0
36
- });
37
- $[1] = styles.container;
38
- $[2] = t1;
39
- } else {
40
- t1 = $[2];
41
- }
42
- return t1;
43
- }
44
- const useStyles = () => {
45
- return StyleSheet.create({
46
- container: {
47
- paddingHorizontal: 16,
48
- paddingVertical: 12
49
- }
50
- });
51
- };
52
- //# sourceMappingURL=app_update_banner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app_update_banner.js","names":["React","StyleSheet","View","Updates","Banner","BannerPrimitive","jsx","_jsx","jsxs","_jsxs","AppUpdateBanner","$","_c","styles","useStyles","downloadedUpdateId","useDownloadedUpdateId","t0","Symbol","for","appearance","heading","description","Text","children","Link","onPress","restart","t1","container","style","create","paddingHorizontal","paddingVertical"],"sources":["../../../src/components/conversations/app_update_banner.tsx"],"sourcesContent":["import React from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { Updates } from '../../utils/native_adapters'\nimport { Banner } from '../display/banner'\nimport BannerPrimitive from '../primitive/banner_primitive'\n\nexport function AppUpdateBanner() {\n const styles = useStyles()\n const downloadedUpdateId = Updates.useDownloadedUpdateId()\n\n if (!downloadedUpdateId) return null\n\n return (\n <View style={styles.container}>\n <Banner\n appearance=\"info\"\n heading=\"Chat update available\"\n description={\n <BannerPrimitive.Text>\n <BannerPrimitive.Link onPress={Updates.restart}>Reload</BannerPrimitive.Link> to get the\n latest fixes and improvements.\n </BannerPrimitive.Text>\n }\n />\n </View>\n )\n}\n\nconst useStyles = () => {\n return StyleSheet.create({\n container: {\n paddingHorizontal: 16,\n paddingVertical: 12,\n },\n })\n}\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC/C,SAASC,OAAO,QAAQ,6BAA6B;AACrD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,eAAe,MAAM,+BAA+B;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE3D,OAAO,SAAAC,gBAAA;EAAA,MAAAC,CAAA,GAAAC,EAAA;EACL,MAAAC,MAAA,GAAeC,SAAS,CAAC,CAAC;EAC1B,MAAAC,kBAAA,GAA2BZ,OAAO,CAAAa,qBAAsB,CAAC,CAAC;EAE1D,IAAI,CAACD,kBAAkB;IAAA,OAAS,IAAI;EAAA;EAAA,IAAAE,EAAA;EAAA,IAAAN,CAAA,QAAAO,MAAA,CAAAC,GAAA;IAIhCF,EAAA,gBAAAV,IAAA,CAACH,MAAM;MACMgB,UAAM,EAAN,MAAM;MACTC,OAAuB,EAAvB,uBAAuB;MAE7BC,WAGuB,eAHvBb,KAAA,CAAAJ,eAAA,CAAAkB,IAAA;QAAAC,QAAA,gBACEjB,IAAA,CAAAF,eAAA,CAAAoB,IAAA;UAA+BC,OAAe,EAAfvB,OAAO,CAAAwB,OAAQ;UAAAH,QAAA,EAAE;QAAM,CAAsB,CAAC,8CAE/E;MAAA,CAAsB;IAAC,CAE1B,CAAC;IAAAb,CAAA,MAAAM,EAAA;EAAA;IAAAA,EAAA,GAAAN,CAAA;EAAA;EAAA,IAAAiB,EAAA;EAAA,IAAAjB,CAAA,QAAAE,MAAA,CAAAgB,SAAA;IAVJD,EAAA,gBAAArB,IAAA,CAACL,IAAI;MAAQ4B,KAAgB,EAAhBjB,MAAM,CAAAgB,SAAU;MAAAL,QAAA,EAC3BP;IASE,CACE,CAAC;IAAAN,CAAA,MAAAE,MAAA,CAAAgB,SAAA;IAAAlB,CAAA,MAAAiB,EAAA;EAAA;IAAAA,EAAA,GAAAjB,CAAA;EAAA;EAAA,OAXPiB,EAWO;AAAA;AAIX,MAAMd,SAAS,GAAGA,CAAA,KAAM;EACtB,OAAOb,UAAU,CAAC8B,MAAM,CAAC;IACvBF,SAAS,EAAE;MACTG,iBAAiB,EAAE,EAAE;MACrBC,eAAe,EAAE;IACnB;EACF,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}