Skip to content

Commit 62f29d6

Browse files
committed
fix: lint issues and failing tests
1 parent b8b82aa commit 62f29d6

6 files changed

Lines changed: 76 additions & 57 deletions

File tree

package/src/components/Message/MessageSimple/__tests__/__snapshots__/MessageAvatar.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ exports[`MessageAvatar should render message avatar 1`] = `
2222
"width": 32,
2323
},
2424
{
25-
"backgroundColor": "#003a3f",
25+
"backgroundColor": "#006970",
2626
},
2727
{
2828
"borderColor": "rgba(255, 255, 255, 0.2)",

package/src/components/Message/MessageSimple/__tests__/__snapshots__/MessageTextContainer.test.tsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ exports[`MessageTextContainer should render message text container 1`] = `
2929
"alignItems": "flex-start",
3030
"flexDirection": "row",
3131
"flexWrap": "wrap",
32-
"fontSize": 15,
32+
"fontSize": 17,
3333
"justifyContent": "flex-start",
3434
"lineHeight": 20,
3535
"marginBottom": 8,
@@ -41,7 +41,7 @@ exports[`MessageTextContainer should render message text container 1`] = `
4141
style={
4242
{
4343
"color": "#000000",
44-
"fontSize": 15,
44+
"fontSize": 17,
4545
"lineHeight": 20,
4646
}
4747
}

package/src/components/Poll/components/PollResults/PollOptionFullResults.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,6 @@ const useStyles = () => {
136136
marginLeft: primitives.spacingMd,
137137
},
138138
}),
139-
[],
139+
[semantics.backgroundCoreSurfaceCard, semantics.textPrimary],
140140
);
141141
};

package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap

Lines changed: 54 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ exports[`Thread should match thread snapshot 1`] = `
413413
"width": 32,
414414
},
415415
{
416-
"backgroundColor": "#fcedb9",
416+
"backgroundColor": "#fcd579",
417417
},
418418
{
419419
"borderColor": "rgba(0, 0, 0, 0.1)",
@@ -619,7 +619,7 @@ exports[`Thread should match thread snapshot 1`] = `
619619
"alignItems": "flex-start",
620620
"flexDirection": "row",
621621
"flexWrap": "wrap",
622-
"fontSize": 15,
622+
"fontSize": 17,
623623
"justifyContent": "flex-start",
624624
"lineHeight": 20,
625625
"marginBottom": 8,
@@ -631,7 +631,7 @@ exports[`Thread should match thread snapshot 1`] = `
631631
style={
632632
{
633633
"color": "#000000",
634-
"fontSize": 15,
634+
"fontSize": 17,
635635
"lineHeight": 20,
636636
}
637637
}
@@ -675,7 +675,7 @@ exports[`Thread should match thread snapshot 1`] = `
675675
[
676676
{
677677
"color": "#687385",
678-
"fontSize": 12,
678+
"fontSize": 13,
679679
"fontWeight": 400,
680680
"lineHeight": 16,
681681
},
@@ -780,7 +780,7 @@ exports[`Thread should match thread snapshot 1`] = `
780780
"width": 32,
781781
},
782782
{
783-
"backgroundColor": "#bdfcdb",
783+
"backgroundColor": "#8febbd",
784784
},
785785
{
786786
"borderColor": "rgba(0, 0, 0, 0.1)",
@@ -986,7 +986,7 @@ exports[`Thread should match thread snapshot 1`] = `
986986
"alignItems": "flex-start",
987987
"flexDirection": "row",
988988
"flexWrap": "wrap",
989-
"fontSize": 15,
989+
"fontSize": 17,
990990
"justifyContent": "flex-start",
991991
"lineHeight": 20,
992992
"marginBottom": 8,
@@ -998,7 +998,7 @@ exports[`Thread should match thread snapshot 1`] = `
998998
style={
999999
{
10001000
"color": "#000000",
1001-
"fontSize": 15,
1001+
"fontSize": 17,
10021002
"lineHeight": 20,
10031003
}
10041004
}
@@ -1042,7 +1042,7 @@ exports[`Thread should match thread snapshot 1`] = `
10421042
[
10431043
{
10441044
"color": "#687385",
1045-
"fontSize": 12,
1045+
"fontSize": 13,
10461046
"fontWeight": 400,
10471047
"lineHeight": 16,
10481048
},
@@ -1113,7 +1113,7 @@ exports[`Thread should match thread snapshot 1`] = `
11131113
style={
11141114
{
11151115
"color": "#414552",
1116-
"fontSize": 12,
1116+
"fontSize": 13,
11171117
"fontWeight": 600,
11181118
"lineHeight": 16,
11191119
}
@@ -1183,7 +1183,7 @@ exports[`Thread should match thread snapshot 1`] = `
11831183
"width": 32,
11841184
},
11851185
{
1186-
"backgroundColor": "#fcedb9",
1186+
"backgroundColor": "#fcd579",
11871187
},
11881188
{
11891189
"borderColor": "rgba(0, 0, 0, 0.1)",
@@ -1389,7 +1389,7 @@ exports[`Thread should match thread snapshot 1`] = `
13891389
"alignItems": "flex-start",
13901390
"flexDirection": "row",
13911391
"flexWrap": "wrap",
1392-
"fontSize": 15,
1392+
"fontSize": 17,
13931393
"justifyContent": "flex-start",
13941394
"lineHeight": 20,
13951395
"marginBottom": 8,
@@ -1401,7 +1401,7 @@ exports[`Thread should match thread snapshot 1`] = `
14011401
style={
14021402
{
14031403
"color": "#000000",
1404-
"fontSize": 15,
1404+
"fontSize": 17,
14051405
"lineHeight": 20,
14061406
}
14071407
}
@@ -1445,7 +1445,7 @@ exports[`Thread should match thread snapshot 1`] = `
14451445
[
14461446
{
14471447
"color": "#687385",
1448-
"fontSize": 12,
1448+
"fontSize": 13,
14491449
"fontWeight": 400,
14501450
"lineHeight": 16,
14511451
},
@@ -1552,7 +1552,7 @@ exports[`Thread should match thread snapshot 1`] = `
15521552
"width": 32,
15531553
},
15541554
{
1555-
"backgroundColor": "#bdfcdb",
1555+
"backgroundColor": "#8febbd",
15561556
},
15571557
{
15581558
"borderColor": "rgba(0, 0, 0, 0.1)",
@@ -1758,7 +1758,7 @@ exports[`Thread should match thread snapshot 1`] = `
17581758
"alignItems": "flex-start",
17591759
"flexDirection": "row",
17601760
"flexWrap": "wrap",
1761-
"fontSize": 15,
1761+
"fontSize": 17,
17621762
"justifyContent": "flex-start",
17631763
"lineHeight": 20,
17641764
"marginBottom": 8,
@@ -1770,7 +1770,7 @@ exports[`Thread should match thread snapshot 1`] = `
17701770
style={
17711771
{
17721772
"color": "#000000",
1773-
"fontSize": 15,
1773+
"fontSize": 17,
17741774
"lineHeight": 20,
17751775
}
17761776
}
@@ -1814,7 +1814,7 @@ exports[`Thread should match thread snapshot 1`] = `
18141814
[
18151815
{
18161816
"color": "#687385",
1817-
"fontSize": 12,
1817+
"fontSize": 13,
18181818
"fontWeight": 400,
18191819
"lineHeight": 16,
18201820
},
@@ -2207,39 +2207,43 @@ exports[`Thread should match thread snapshot 1`] = `
22072207
]
22082208
}
22092209
>
2210-
<TextInput
2211-
autoFocus={true}
2212-
editable={true}
2213-
maxLength={5000}
2214-
multiline={true}
2215-
onChangeText={[Function]}
2216-
onSelectionChange={[Function]}
2217-
placeholder="Send a message"
2218-
placeholderTextColor="#687385"
2219-
style={
2220-
[
2221-
{
2222-
"color": "#1a1b25",
2223-
"flex": 1,
2224-
"fontSize": 16,
2225-
"includeFontPadding": false,
2226-
"lineHeight": 20,
2227-
"paddingLeft": 16,
2228-
"paddingVertical": 12,
2229-
"textAlignVertical": "center",
2230-
},
2231-
{
2232-
"maxHeight": 124,
2233-
"paddingLeft": 16,
2234-
"paddingRight": 8,
2235-
"textAlign": "left",
2236-
},
2237-
{},
2238-
]
2239-
}
2240-
testID="auto-complete-text-input"
2241-
value=""
2242-
/>
2210+
<View
2211+
layout={BaseAnimationMock {}}
2212+
>
2213+
<TextInput
2214+
autoFocus={true}
2215+
editable={true}
2216+
maxLength={5000}
2217+
multiline={true}
2218+
onChangeText={[Function]}
2219+
onSelectionChange={[Function]}
2220+
placeholder="Send a message"
2221+
placeholderTextColor="#687385"
2222+
style={
2223+
[
2224+
{
2225+
"color": "#1a1b25",
2226+
"flex": 1,
2227+
"fontSize": 16,
2228+
"includeFontPadding": false,
2229+
"lineHeight": 20,
2230+
"paddingLeft": 16,
2231+
"paddingVertical": 12,
2232+
"textAlignVertical": "center",
2233+
},
2234+
{
2235+
"maxHeight": 124,
2236+
"paddingLeft": 16,
2237+
"paddingRight": 8,
2238+
"textAlign": "left",
2239+
},
2240+
{},
2241+
]
2242+
}
2243+
testID="auto-complete-text-input"
2244+
value=""
2245+
/>
2246+
</View>
22432247
<View
22442248
style={
22452249
[

package/src/utils/__tests__/Streami18n.test.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ describe('Streami18n instance - with built-in language', () => {
5050
it('should provide dutch translator', async () => {
5151
const { t: _t } = await streami18n.getTranslators();
5252
for (const key in nlTranslations) {
53-
if ((key.indexOf('{{') > -1 && key.indexOf('}}') > -1) || key.indexOf('duration/') > -1) {
53+
const value = nlTranslations[key];
54+
const hasTemplateInKey = key.indexOf('{{') > -1 && key.indexOf('}}') > -1;
55+
const hasTemplateInValue =
56+
typeof value === 'string' && value.indexOf('{{') > -1 && value.indexOf('}}') > -1;
57+
if (hasTemplateInKey || hasTemplateInValue || key.indexOf('duration/') > -1) {
5458
continue;
5559
}
5660

@@ -74,7 +78,11 @@ describe('Streami18n instance - with built-in language', () => {
7478
it('should provide dutch translator', async () => {
7579
const { t: _t } = await streami18n.getTranslators();
7680
for (const key in nlTranslations) {
77-
if ((key.indexOf('{{') > -1 && key.indexOf('}}') > -1) || key.indexOf('duration/') > -1) {
81+
const value = nlTranslations[key];
82+
const hasTemplateInKey = key.indexOf('{{') > -1 && key.indexOf('}}') > -1;
83+
const hasTemplateInValue =
84+
typeof value === 'string' && value.indexOf('{{') > -1 && value.indexOf('}}') > -1;
85+
if (hasTemplateInKey || hasTemplateInValue || key.indexOf('duration/') > -1) {
7886
continue;
7987
}
8088

@@ -189,7 +197,11 @@ describe('setLanguage - switch to french', () => {
189197
const { t: _t } = await streami18n.getTranslators();
190198
for (const key in frTranslations) {
191199
// Skip keys with template strings or duration keys
192-
if ((key.indexOf('{{') > -1 && key.indexOf('}}') > -1) || key.indexOf('duration/') > -1) {
200+
const value = frTranslations[key];
201+
const hasTemplateInKey = key.indexOf('{{') > -1 && key.indexOf('}}') > -1;
202+
const hasTemplateInValue =
203+
typeof value === 'string' && value.indexOf('{{') > -1 && value.indexOf('}}') > -1;
204+
if (hasTemplateInKey || hasTemplateInValue || key.indexOf('duration/') > -1) {
193205
continue;
194206
}
195207

package/src/utils/i18n/predefinedFormatters.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ export const predefinedFormatters: PredefinedFormatters = {
5353
return result;
5454
},
5555
relativeCompactDateFormatter: (streamI18n) => (value) => {
56+
if (value === undefined || value === null) {
57+
return JSON.stringify(value);
58+
}
5659
const parsedTime = streamI18n.tDateTimeParser(value);
5760
const parsedNow = streamI18n.tDateTimeParser();
5861

0 commit comments

Comments
 (0)