react-native-acoustic-connect-beta 19.0.19 → 19.0.21

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.
@@ -1,290 +0,0 @@
1
- import configureFonts, { fontConfig } from '../fonts';
2
- import { typescale } from '../themes/v3/tokens';
3
-
4
- const mockPlatform = (OS) => {
5
- jest.resetModules();
6
- jest.doMock('react-native/Libraries/Utilities/Platform', () => ({
7
- OS,
8
- select: (objs) => objs[OS],
9
- }));
10
- };
11
-
12
- const customFont = {
13
- custom: {
14
- fontFamily: 'sans-serif',
15
- fontWeight: 'bold',
16
- },
17
- };
18
-
19
- const customFontV3 = {
20
- displayLarge: {
21
- fontFamily: 'NotoSans',
22
- letterSpacing: 0,
23
- fontWeight: '400',
24
- lineHeight: 64,
25
- fontSize: 57,
26
- },
27
- displayMedium: {
28
- fontFamily: 'NotoSans',
29
- letterSpacing: 0,
30
- fontWeight: '400',
31
- lineHeight: 52,
32
- fontSize: 45,
33
- },
34
- displaySmall: {
35
- fontFamily: 'NotoSans',
36
- letterSpacing: 0,
37
- fontWeight: '400',
38
- lineHeight: 44,
39
- fontSize: 36,
40
- },
41
-
42
- headlineLarge: {
43
- fontFamily: 'NotoSans',
44
- letterSpacing: 0,
45
- fontWeight: '400',
46
- lineHeight: 40,
47
- fontSize: 32,
48
- },
49
- headlineMedium: {
50
- fontFamily: 'NotoSans',
51
- letterSpacing: 0,
52
- fontWeight: '400',
53
- lineHeight: 36,
54
- fontSize: 28,
55
- },
56
- headlineSmall: {
57
- fontFamily: 'NotoSans',
58
- letterSpacing: 0,
59
- fontWeight: '400',
60
- lineHeight: 32,
61
- fontSize: 24,
62
- },
63
-
64
- titleLarge: {
65
- fontFamily: 'NotoSans',
66
- letterSpacing: 0,
67
- fontWeight: '400',
68
- lineHeight: 28,
69
- fontSize: 22,
70
- },
71
- titleMedium: {
72
- fontFamily: 'NotoSans',
73
- letterSpacing: 0,
74
- fontWeight: '500',
75
- lineHeight: 24,
76
- fontSize: 16,
77
- },
78
- titleSmall: {
79
- fontFamily: 'NotoSans',
80
- fontWeight: '500',
81
- letterSpacing: 0,
82
- lineHeight: 20,
83
- fontSize: 14,
84
- },
85
-
86
- labelLarge: {
87
- fontFamily: 'NotoSans',
88
- fontWeight: '500',
89
- letterSpacing: 0,
90
- lineHeight: 20,
91
- fontSize: 14,
92
- },
93
- labelMedium: {
94
- fontFamily: 'NotoSans',
95
- fontWeight: '500',
96
- letterSpacing: 0,
97
- lineHeight: 16,
98
- fontSize: 12,
99
- },
100
- labelSmall: {
101
- fontFamily: 'NotoSans',
102
- fontWeight: '500',
103
- letterSpacing: 0,
104
- lineHeight: 16,
105
- fontSize: 11,
106
- },
107
-
108
- bodyLarge: {
109
- fontFamily: 'NotoSans',
110
- letterSpacing: 0,
111
- fontWeight: '400',
112
- lineHeight: 24,
113
- fontSize: 16,
114
- },
115
- bodyMedium: {
116
- fontFamily: 'NotoSans',
117
- fontWeight: '400',
118
- letterSpacing: 0,
119
- lineHeight: 20,
120
- fontSize: 14,
121
- },
122
- bodySmall: {
123
- fontFamily: 'NotoSans',
124
- fontWeight: '400',
125
- letterSpacing: 0,
126
- lineHeight: 16,
127
- fontSize: 12,
128
- },
129
-
130
- default: {
131
- fontFamily: 'NotoSans',
132
- letterSpacing: 0,
133
- fontWeight: '400',
134
- },
135
- };
136
-
137
- describe('configureFonts', () => {
138
- it('adds custom fonts to the iOS config', () => {
139
- mockPlatform('ios');
140
- expect(
141
- configureFonts({
142
- config: {
143
- ios: {
144
- ...fontConfig.ios,
145
- customFont,
146
- },
147
- },
148
- isV3: false,
149
- })
150
- ).toEqual({
151
- ...fontConfig.ios,
152
- customFont,
153
- });
154
- });
155
-
156
- it('adds custom fonts to the Android config', () => {
157
- mockPlatform('android');
158
- expect(
159
- configureFonts({
160
- config: {
161
- android: {
162
- ...fontConfig.android,
163
- customFont,
164
- },
165
- },
166
- isV3: false,
167
- })
168
- ).toEqual({
169
- ...fontConfig.android,
170
- customFont,
171
- });
172
- });
173
-
174
- it('adds custom fonts to the Web config', () => {
175
- mockPlatform('web');
176
- expect(
177
- configureFonts({
178
- config: {
179
- web: {
180
- ...fontConfig.web,
181
- customFont,
182
- },
183
- },
184
- isV3: false,
185
- })
186
- ).toEqual({
187
- ...fontConfig.web,
188
- customFont,
189
- });
190
- });
191
-
192
- it('overrides properties passed in config for all variants', () => {
193
- expect(
194
- configureFonts({
195
- config: {
196
- fontFamily: 'NotoSans',
197
- letterSpacing: 0,
198
- },
199
- })
200
- ).toEqual(customFontV3);
201
- });
202
-
203
- it('overrides properties passed in config for several variants', () => {
204
- expect(
205
- configureFonts({
206
- config: {
207
- bodyLarge: {
208
- fontFamily: 'NotoSans',
209
- fontSize: 18,
210
- fontStyle: 'italic',
211
- },
212
- headlineMedium: {
213
- fontSize: 30,
214
- },
215
- bodySmall: {
216
- fontStyle: 'italic',
217
- },
218
- },
219
- })
220
- ).toEqual({
221
- ...typescale,
222
- bodyLarge: {
223
- fontFamily: 'NotoSans',
224
- letterSpacing: 0.15,
225
- fontWeight: '400',
226
- fontStyle: 'italic',
227
- lineHeight: 24,
228
- fontSize: 18,
229
- },
230
- headlineMedium: {
231
- fontFamily: 'System',
232
- letterSpacing: 0,
233
- fontWeight: '400',
234
- lineHeight: 36,
235
- fontSize: 30,
236
- },
237
- bodySmall: {
238
- fontFamily: 'System',
239
- fontWeight: '400',
240
- fontStyle: 'italic',
241
- letterSpacing: 0.4,
242
- lineHeight: 16,
243
- fontSize: 12,
244
- },
245
- });
246
- });
247
-
248
- it('adds custom variant to theme fonts', () => {
249
- expect(
250
- configureFonts({
251
- config: {
252
- customVariant: {
253
- fontFamily: 'NotoSans',
254
- letterSpacing: 0,
255
- fontWeight: '400',
256
- fontStyle: 'italic',
257
- lineHeight: 64,
258
- fontSize: 57,
259
- },
260
- },
261
- })
262
- ).toEqual({
263
- ...typescale,
264
- customVariant: {
265
- fontFamily: 'NotoSans',
266
- letterSpacing: 0,
267
- fontWeight: '400',
268
- fontStyle: 'italic',
269
- lineHeight: 64,
270
- fontSize: 57,
271
- },
272
- });
273
- });
274
-
275
- it('should be deterministic', () => {
276
- // first call that should not mutate the original config
277
- configureFonts({
278
- config: {
279
- labelMedium: {
280
- color: 'coral',
281
- },
282
- },
283
- });
284
-
285
- // second call that should return the original config without modification
286
- const fontsB = configureFonts({ config: {} });
287
-
288
- expect(fontsB.labelMedium.color).toBeUndefined();
289
- });
290
- });
@@ -1,88 +0,0 @@
1
- // Copyright (C) 2026 Acoustic, L.P. All rights reserved.
2
- //
3
- // Unit tests for ensureConnectConfig's local→bundled→missing fallback in
4
- // cli/doctor.mjs. Uses Node's built-in test runner (node:test) — no build
5
- // step needed, cli/ is plain ESM.
6
- //
7
- // npm run test:cli
8
-
9
- import { test } from 'node:test'
10
- import assert from 'node:assert/strict'
11
- import * as fs from 'node:fs'
12
- import * as os from 'node:os'
13
- import * as path from 'node:path'
14
-
15
- import { ensureConnectConfig } from '../doctor.mjs'
16
- import { Reporter } from '../lib.mjs'
17
-
18
- function tmpDir() {
19
- return fs.mkdtempSync(path.join(os.tmpdir(), 'connect-doctor-test-'))
20
- }
21
-
22
- // ensureConnectConfig's 'exists' branch reports as `pass('ConnectConfig.json present')`
23
- // (label includes the detail) while the other branches use a plain
24
- // 'ConnectConfig.json' label with a separate detail string — match by prefix
25
- // so the assertion doesn't depend on that formatting quirk.
26
- function statusFor(reporter, labelPrefix) {
27
- return reporter.results.find((r) => r.label.startsWith(labelPrefix))?.status
28
- }
29
-
30
- test('ensureConnectConfig: prefers a project-local ConnectConfig.example.json over the bundled one', () => {
31
- const dir = tmpDir()
32
- fs.writeFileSync(
33
- path.join(dir, 'ConnectConfig.example.json'),
34
- JSON.stringify({ Connect: { AppKey: 'from-local-example' } }),
35
- )
36
- const reporter = new Reporter()
37
-
38
- ensureConnectConfig(reporter, dir, {
39
- bundledExample: path.join(dir, 'never-read.json'),
40
- })
41
-
42
- const written = JSON.parse(fs.readFileSync(path.join(dir, 'ConnectConfig.json'), 'utf8'))
43
- assert.equal(written.Connect.AppKey, 'from-local-example')
44
- assert.equal(statusFor(reporter, 'ConnectConfig.json'), 'warn')
45
- })
46
-
47
- test('ensureConnectConfig: falls back to the bundled example when no project-local one exists', () => {
48
- const dir = tmpDir()
49
- const bundledDir = tmpDir()
50
- const bundledExample = path.join(bundledDir, 'ConnectConfig.example.json')
51
- fs.writeFileSync(bundledExample, JSON.stringify({ Connect: { AppKey: 'from-bundled-example' } }))
52
- const reporter = new Reporter()
53
-
54
- ensureConnectConfig(reporter, dir, { bundledExample })
55
-
56
- const written = JSON.parse(fs.readFileSync(path.join(dir, 'ConnectConfig.json'), 'utf8'))
57
- assert.equal(written.Connect.AppKey, 'from-bundled-example')
58
- assert.equal(statusFor(reporter, 'ConnectConfig.json'), 'warn')
59
- })
60
-
61
- test('ensureConnectConfig: fails cleanly (no crash, no file written) when both are missing', () => {
62
- const dir = tmpDir()
63
- const reporter = new Reporter()
64
-
65
- ensureConnectConfig(reporter, dir, {
66
- bundledExample: path.join(dir, 'does-not-exist.json'),
67
- })
68
-
69
- assert.equal(fs.existsSync(path.join(dir, 'ConnectConfig.json')), false)
70
- assert.equal(statusFor(reporter, 'ConnectConfig.json'), 'fail')
71
- })
72
-
73
- test('ensureConnectConfig: never overwrites an existing ConnectConfig.json', () => {
74
- const dir = tmpDir()
75
- fs.writeFileSync(
76
- path.join(dir, 'ConnectConfig.json'),
77
- JSON.stringify({ Connect: { AppKey: 'already-configured' } }),
78
- )
79
- const reporter = new Reporter()
80
-
81
- ensureConnectConfig(reporter, dir, {
82
- bundledExample: path.join(dir, 'never-read.json'),
83
- })
84
-
85
- const written = JSON.parse(fs.readFileSync(path.join(dir, 'ConnectConfig.json'), 'utf8'))
86
- assert.equal(written.Connect.AppKey, 'already-configured')
87
- assert.equal(statusFor(reporter, 'ConnectConfig.json'), 'pass')
88
- })