@applicaster/zapp-react-native-utils 15.1.8 → 15.1.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.
@@ -1352,6 +1352,35 @@ function getPlayerConfiguration({ platform, version }) {
1352
1352
  type: "switch",
1353
1353
  label_tooltip: "Select whether you want to display title in player",
1354
1354
  },
1355
+ {
1356
+ section: "title",
1357
+ key: "title_data_key_source",
1358
+ label: "Title data key",
1359
+ initial_value: "title",
1360
+ type: "select",
1361
+ options: [
1362
+ { text: "Title", value: "title" },
1363
+ { text: "Other", value: "other" },
1364
+ ],
1365
+ label_tooltip:
1366
+ "Select which feed data key provides the player content title. Keep 'Title' to use the entry title",
1367
+ },
1368
+ {
1369
+ section: "title",
1370
+ key: "title_custom_data_key",
1371
+ label: "Custom title data key",
1372
+ initial_value: "",
1373
+ type: "text_input",
1374
+ rules: "conditional",
1375
+ conditional_fields: [
1376
+ {
1377
+ key: "styles/title_data_key_source",
1378
+ condition_value: "other",
1379
+ },
1380
+ ],
1381
+ label_tooltip:
1382
+ "Data key on the feed entry, dot notation supported, for example extensions.episode_name. Falls back to the entry title if the key is empty or missing",
1383
+ },
1355
1384
  {
1356
1385
  section: "title",
1357
1386
  key: "title_font_android",
@@ -1759,6 +1788,35 @@ function getPlayerConfiguration({ platform, version }) {
1759
1788
  label_tooltip:
1760
1789
  "Select whether you want to display subtitle in player",
1761
1790
  },
1791
+ {
1792
+ section: "subtitle",
1793
+ key: "subtitle_data_key_source",
1794
+ label: "Subtitle data key",
1795
+ initial_value: "summary",
1796
+ type: "select",
1797
+ options: [
1798
+ { text: "Subtitle", value: "summary" },
1799
+ { text: "Other", value: "other" },
1800
+ ],
1801
+ label_tooltip:
1802
+ "Select which feed data key provides the player content subtitle. Keep 'Subtitle' to use the entry summary",
1803
+ },
1804
+ {
1805
+ section: "subtitle",
1806
+ key: "subtitle_custom_data_key",
1807
+ label: "Custom subtitle data key",
1808
+ initial_value: "",
1809
+ type: "text_input",
1810
+ rules: "conditional",
1811
+ conditional_fields: [
1812
+ {
1813
+ key: "styles/subtitle_data_key_source",
1814
+ condition_value: "other",
1815
+ },
1816
+ ],
1817
+ label_tooltip:
1818
+ "Data key on the feed entry, dot notation supported, for example extensions.episode_subtitle. Falls back to the entry summary if the key is empty or missing",
1819
+ },
1762
1820
  {
1763
1821
  section: "subtitle",
1764
1822
  key: "subtitle_font_android",
@@ -2923,6 +2981,33 @@ function getPlayerConfiguration({ platform, version }) {
2923
2981
  "Video Player - Title Text",
2924
2982
  "Video Player Title Text Label Styles",
2925
2983
  [
2984
+ {
2985
+ key: "video_player_title_data_key_source",
2986
+ label: "Video title data key",
2987
+ initial_value: "title",
2988
+ type: "select",
2989
+ options: [
2990
+ { text: "Title", value: "title" },
2991
+ { text: "Other", value: "other" },
2992
+ ],
2993
+ label_tooltip:
2994
+ "Select which feed data key provides the video player title. Keep 'Title' to use the entry title",
2995
+ },
2996
+ {
2997
+ key: "video_player_title_custom_data_key",
2998
+ label: "Custom video title data key",
2999
+ initial_value: "",
3000
+ type: "text_input",
3001
+ rules: "conditional",
3002
+ conditional_fields: [
3003
+ {
3004
+ key: "styles/video_player_title_data_key_source",
3005
+ condition_value: "other",
3006
+ },
3007
+ ],
3008
+ label_tooltip:
3009
+ "Data key on the feed entry, dot notation supported, for example extensions.episode_name. Falls back to the entry title if the key is empty or missing",
3010
+ },
2926
3011
  {
2927
3012
  key: "player_title_color",
2928
3013
  label: "Font color",
@@ -3008,6 +3093,33 @@ function getPlayerConfiguration({ platform, version }) {
3008
3093
  "Video Player - Summary Text",
3009
3094
  "Video Player Summary Text Label Styles",
3010
3095
  [
3096
+ {
3097
+ key: "video_player_summary_data_key_source",
3098
+ label: "Video summary data key",
3099
+ initial_value: "summary",
3100
+ type: "select",
3101
+ options: [
3102
+ { text: "Summary", value: "summary" },
3103
+ { text: "Other", value: "other" },
3104
+ ],
3105
+ label_tooltip:
3106
+ "Select which feed data key provides the video player summary. Keep 'Summary' to use the entry summary",
3107
+ },
3108
+ {
3109
+ key: "video_player_summary_custom_data_key",
3110
+ label: "Custom video summary data key",
3111
+ initial_value: "",
3112
+ type: "text_input",
3113
+ rules: "conditional",
3114
+ conditional_fields: [
3115
+ {
3116
+ key: "styles/video_player_summary_data_key_source",
3117
+ condition_value: "other",
3118
+ },
3119
+ ],
3120
+ label_tooltip:
3121
+ "Data key on the feed entry, dot notation supported, for example extensions.episode_subtitle. Falls back to the entry summary if the key is empty or missing",
3122
+ },
3011
3123
  {
3012
3124
  key: "player_summary_color",
3013
3125
  label: "Font color",
@@ -3093,6 +3205,33 @@ function getPlayerConfiguration({ platform, version }) {
3093
3205
  "Audio Player - Title Text",
3094
3206
  "Audio Player Title Text Label Styles",
3095
3207
  [
3208
+ {
3209
+ key: "audio_player_title_data_key_source",
3210
+ label: "Audio title data key",
3211
+ initial_value: "title",
3212
+ type: "select",
3213
+ options: [
3214
+ { text: "Title", value: "title" },
3215
+ { text: "Other", value: "other" },
3216
+ ],
3217
+ label_tooltip:
3218
+ "Select which feed data key provides the audio player title. Keep 'Title' to use the entry title",
3219
+ },
3220
+ {
3221
+ key: "audio_player_title_custom_data_key",
3222
+ label: "Custom audio title data key",
3223
+ initial_value: "",
3224
+ type: "text_input",
3225
+ rules: "conditional",
3226
+ conditional_fields: [
3227
+ {
3228
+ key: "styles/audio_player_title_data_key_source",
3229
+ condition_value: "other",
3230
+ },
3231
+ ],
3232
+ label_tooltip:
3233
+ "Data key on the feed entry, dot notation supported, for example extensions.episode_name. Falls back to the entry title if the key is empty or missing",
3234
+ },
3096
3235
  {
3097
3236
  key: "audio_player_title_color",
3098
3237
  label: "Audio player title color",
@@ -3178,6 +3317,33 @@ function getPlayerConfiguration({ platform, version }) {
3178
3317
  "Audio Player - Summary Text",
3179
3318
  "Audio Player Summary Text Label Styles",
3180
3319
  [
3320
+ {
3321
+ key: "audio_player_summary_data_key_source",
3322
+ label: "Audio summary data key",
3323
+ initial_value: "summary",
3324
+ type: "select",
3325
+ options: [
3326
+ { text: "Summary", value: "summary" },
3327
+ { text: "Other", value: "other" },
3328
+ ],
3329
+ label_tooltip:
3330
+ "Select which feed data key provides the audio player summary. Keep 'Summary' to use the entry summary",
3331
+ },
3332
+ {
3333
+ key: "audio_player_summary_custom_data_key",
3334
+ label: "Custom audio summary data key",
3335
+ initial_value: "",
3336
+ type: "text_input",
3337
+ rules: "conditional",
3338
+ conditional_fields: [
3339
+ {
3340
+ key: "styles/audio_player_summary_data_key_source",
3341
+ condition_value: "other",
3342
+ },
3343
+ ],
3344
+ label_tooltip:
3345
+ "Data key on the feed entry, dot notation supported, for example extensions.episode_subtitle. Falls back to the entry summary if the key is empty or missing",
3346
+ },
3181
3347
  {
3182
3348
  key: "audio_player_summary_color",
3183
3349
  label: "Audio player summary color",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "15.1.8",
3
+ "version": "15.1.9",
4
4
  "description": "Applicaster Zapp React Native utilities package",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "homepage": "https://github.com/applicaster/quickbrick#readme",
29
29
  "dependencies": {
30
- "@applicaster/applicaster-types": "15.1.8",
30
+ "@applicaster/applicaster-types": "15.1.9",
31
31
  "buffer": "^5.2.1",
32
32
  "camelize": "^1.0.0",
33
33
  "dayjs": "^1.11.10",
@@ -0,0 +1,297 @@
1
+ import {
2
+ resolvePlayerContentText,
3
+ VIDEO_PLAYER_CONTENT_DATA_KEYS,
4
+ AUDIO_PLAYER_CONTENT_DATA_KEYS,
5
+ createConfigValueGetter,
6
+ } from "../contentDataKeys";
7
+
8
+ const entry = {
9
+ id: "1",
10
+ type: { value: "audio" },
11
+ title: "Default Title",
12
+ summary: "Default Summary",
13
+ extensions: {
14
+ episode_name: "Custom Episode",
15
+ episode_subtitle: "Custom Subtitle",
16
+ blank: "",
17
+ show: { name: "Nested Show Name" },
18
+ genres: ["Drama", "Comedy"],
19
+ rating: 0,
20
+ is_featured: true,
21
+ },
22
+ } as unknown as ZappEntry;
23
+
24
+ const valueFrom =
25
+ (config: Record<string, unknown>): GetValue =>
26
+ (key: string) =>
27
+ (config[key] ?? null) as never;
28
+
29
+ const resolveTitle = (config: Record<string, unknown>, target = entry) =>
30
+ resolvePlayerContentText({
31
+ entry: target,
32
+ field: "title",
33
+ value: valueFrom(config),
34
+ });
35
+
36
+ const resolveSubtitle = (config: Record<string, unknown>, target = entry) =>
37
+ resolvePlayerContentText({
38
+ entry: target,
39
+ field: "subtitle",
40
+ value: valueFrom(config),
41
+ });
42
+
43
+ describe("resolvePlayerContentText", () => {
44
+ describe("backward compatibility", () => {
45
+ it("returns entry.title when no configuration is stored", () => {
46
+ expect(resolveTitle({})).toBe("Default Title");
47
+ });
48
+
49
+ it("returns entry.summary when no configuration is stored", () => {
50
+ expect(resolveSubtitle({})).toBe("Default Summary");
51
+ });
52
+
53
+ it("returns the defaults when the source is explicitly the default option", () => {
54
+ expect(
55
+ resolveTitle({
56
+ title_data_key_source: "title",
57
+ title_custom_data_key: "extensions.episode_name",
58
+ })
59
+ ).toBe("Default Title");
60
+
61
+ expect(
62
+ resolveSubtitle({
63
+ subtitle_data_key_source: "summary",
64
+ subtitle_custom_data_key: "extensions.episode_subtitle",
65
+ })
66
+ ).toBe("Default Summary");
67
+ });
68
+ });
69
+
70
+ describe("custom data key", () => {
71
+ it("resolves a dot path on the entry for the title", () => {
72
+ expect(
73
+ resolveTitle({
74
+ title_data_key_source: "other",
75
+ title_custom_data_key: "extensions.episode_name",
76
+ })
77
+ ).toBe("Custom Episode");
78
+ });
79
+
80
+ it("resolves a dot path on the entry for the subtitle", () => {
81
+ expect(
82
+ resolveSubtitle({
83
+ subtitle_data_key_source: "other",
84
+ subtitle_custom_data_key: "extensions.episode_subtitle",
85
+ })
86
+ ).toBe("Custom Subtitle");
87
+ });
88
+
89
+ it("resolves a nested dot path", () => {
90
+ expect(
91
+ resolveTitle({
92
+ title_data_key_source: "other",
93
+ title_custom_data_key: "extensions.show.name",
94
+ })
95
+ ).toBe("Nested Show Name");
96
+ });
97
+
98
+ it("resolves a top level entry key", () => {
99
+ expect(
100
+ resolveTitle({
101
+ title_data_key_source: "other",
102
+ title_custom_data_key: "summary",
103
+ })
104
+ ).toBe("Default Summary");
105
+ });
106
+
107
+ it("trims surrounding whitespace from the configured key", () => {
108
+ expect(
109
+ resolveTitle({
110
+ title_data_key_source: "other",
111
+ title_custom_data_key: " extensions.episode_name ",
112
+ })
113
+ ).toBe("Custom Episode");
114
+ });
115
+ });
116
+
117
+ describe("fallbacks", () => {
118
+ it("falls back to the default when the custom key is empty", () => {
119
+ expect(
120
+ resolveTitle({
121
+ title_data_key_source: "other",
122
+ title_custom_data_key: "",
123
+ })
124
+ ).toBe("Default Title");
125
+ });
126
+
127
+ it("falls back to the default when the custom key is whitespace only", () => {
128
+ expect(
129
+ resolveTitle({
130
+ title_data_key_source: "other",
131
+ title_custom_data_key: " ",
132
+ })
133
+ ).toBe("Default Title");
134
+ });
135
+
136
+ it("falls back to the default when the custom key does not resolve", () => {
137
+ expect(
138
+ resolveTitle({
139
+ title_data_key_source: "other",
140
+ title_custom_data_key: "extensions.does_not_exist",
141
+ })
142
+ ).toBe("Default Title");
143
+ });
144
+
145
+ it("falls back to the default when the custom key resolves to an empty string", () => {
146
+ expect(
147
+ resolveTitle({
148
+ title_data_key_source: "other",
149
+ title_custom_data_key: "extensions.blank",
150
+ })
151
+ ).toBe("Default Title");
152
+ });
153
+
154
+ // The Studio field is free text, so a customer can easily stop one
155
+ // segment short (`extensions.show` rather than `extensions.show.name`)
156
+ // or aim the key at a list field. Rendering those would throw
157
+ // "Objects are not valid as a React child" and red-screen every screen
158
+ // containing the player.
159
+ it("falls back to the default when the custom key resolves to an object", () => {
160
+ expect(
161
+ resolveTitle({
162
+ title_data_key_source: "other",
163
+ title_custom_data_key: "extensions.show",
164
+ })
165
+ ).toBe("Default Title");
166
+ });
167
+
168
+ it("falls back to the default when the custom key resolves to an array", () => {
169
+ expect(
170
+ resolveSubtitle({
171
+ subtitle_data_key_source: "other",
172
+ subtitle_custom_data_key: "extensions.genres",
173
+ })
174
+ ).toBe("Default Summary");
175
+ });
176
+
177
+ it("falls back to the default when the custom key resolves to a boolean", () => {
178
+ expect(
179
+ resolveTitle({
180
+ title_data_key_source: "other",
181
+ title_custom_data_key: "extensions.is_featured",
182
+ })
183
+ ).toBe("Default Title");
184
+ });
185
+
186
+ // Numbers are renderable, so the guard above must not swallow them -
187
+ // including 0, which is falsy but perfectly displayable.
188
+ it("returns a numeric custom value rather than falling back", () => {
189
+ expect(
190
+ resolveTitle({
191
+ title_data_key_source: "other",
192
+ title_custom_data_key: "extensions.rating",
193
+ })
194
+ ).toBe(0);
195
+ });
196
+ });
197
+
198
+ describe("missing entry", () => {
199
+ it("returns undefined without throwing when the entry is undefined", () => {
200
+ expect(
201
+ resolvePlayerContentText({
202
+ entry: undefined,
203
+ field: "title",
204
+ value: valueFrom({}),
205
+ })
206
+ ).toBeUndefined();
207
+ });
208
+
209
+ it("returns undefined without throwing when a custom key is set", () => {
210
+ expect(
211
+ resolvePlayerContentText({
212
+ entry: undefined,
213
+ field: "title",
214
+ value: valueFrom({
215
+ title_data_key_source: "other",
216
+ title_custom_data_key: "extensions.episode_name",
217
+ }),
218
+ })
219
+ ).toBeUndefined();
220
+ });
221
+ });
222
+ });
223
+
224
+ describe("custom data key sets", () => {
225
+ it("reads the TV video keys when given that key set", () => {
226
+ const value = createConfigValueGetter({
227
+ video_player_title_data_key_source: "other",
228
+ video_player_title_custom_data_key: "extensions.episode_name",
229
+ });
230
+
231
+ expect(
232
+ resolvePlayerContentText({
233
+ entry,
234
+ field: "title",
235
+ value,
236
+ dataKeys: VIDEO_PLAYER_CONTENT_DATA_KEYS,
237
+ })
238
+ ).toBe("Custom Episode");
239
+ });
240
+
241
+ it("reads the TV audio keys when given that key set", () => {
242
+ const value = createConfigValueGetter({
243
+ audio_player_summary_data_key_source: "other",
244
+ audio_player_summary_custom_data_key: "extensions.episode_subtitle",
245
+ });
246
+
247
+ expect(
248
+ resolvePlayerContentText({
249
+ entry,
250
+ field: "subtitle",
251
+ value,
252
+ dataKeys: AUDIO_PLAYER_CONTENT_DATA_KEYS,
253
+ })
254
+ ).toBe("Custom Subtitle");
255
+ });
256
+
257
+ it("ignores the mobile keys when a TV key set is supplied", () => {
258
+ const value = createConfigValueGetter({
259
+ title_data_key_source: "other",
260
+ title_custom_data_key: "extensions.episode_name",
261
+ });
262
+
263
+ expect(
264
+ resolvePlayerContentText({
265
+ entry,
266
+ field: "title",
267
+ value,
268
+ dataKeys: VIDEO_PLAYER_CONTENT_DATA_KEYS,
269
+ })
270
+ ).toBe("Default Title");
271
+ });
272
+
273
+ it("defaults to the mobile key set when dataKeys is omitted", () => {
274
+ const value = createConfigValueGetter({
275
+ title_data_key_source: "other",
276
+ title_custom_data_key: "extensions.episode_name",
277
+ });
278
+
279
+ expect(resolvePlayerContentText({ entry, field: "title", value })).toBe(
280
+ "Custom Episode"
281
+ );
282
+ });
283
+ });
284
+
285
+ describe("createConfigValueGetter", () => {
286
+ it("returns null for a missing key", () => {
287
+ expect(createConfigValueGetter({})("anything")).toBeNull();
288
+ });
289
+
290
+ it("returns null for an undefined configuration", () => {
291
+ expect(createConfigValueGetter(undefined)("anything")).toBeNull();
292
+ });
293
+
294
+ it("returns the stored value", () => {
295
+ expect(createConfigValueGetter({ a: "b" })("a")).toBe("b");
296
+ });
297
+ });
@@ -0,0 +1,180 @@
1
+ import {
2
+ resolvePlayerTitleSubtitle,
3
+ getPlayerContentDataKeys,
4
+ } from "../resolvePlayerTitleSubtitle";
5
+ import {
6
+ VIDEO_PLAYER_CONTENT_DATA_KEYS,
7
+ AUDIO_PLAYER_CONTENT_DATA_KEYS,
8
+ } from "../contentDataKeys";
9
+
10
+ const entry = {
11
+ id: "1",
12
+ title: "Default Title",
13
+ summary: "Default Summary",
14
+ extensions: {
15
+ episode_name: "Custom Episode",
16
+ episode_subtitle: "Custom Subtitle",
17
+ },
18
+ } as unknown as ZappEntry;
19
+
20
+ describe("resolvePlayerTitleSubtitle", () => {
21
+ it("returns entry.title/entry.summary when nothing is configured", () => {
22
+ expect(
23
+ resolvePlayerTitleSubtitle({ entry, pluginConfiguration: {} })
24
+ ).toEqual({
25
+ title: "Default Title",
26
+ summary: "Default Summary",
27
+ });
28
+ });
29
+
30
+ it("returns entry.title/entry.summary when pluginConfiguration is undefined", () => {
31
+ expect(
32
+ resolvePlayerTitleSubtitle({ entry, pluginConfiguration: undefined })
33
+ ).toEqual({
34
+ title: "Default Title",
35
+ summary: "Default Summary",
36
+ });
37
+ });
38
+
39
+ it("returns null for both fields without throwing when entry is missing", () => {
40
+ expect(
41
+ resolvePlayerTitleSubtitle({
42
+ entry: undefined,
43
+ pluginConfiguration: {
44
+ title_data_key_source: "other",
45
+ title_custom_data_key: "extensions.episode_name",
46
+ },
47
+ })
48
+ ).toEqual({ title: null, summary: null });
49
+ });
50
+
51
+ it("does not mutate the entry it is given", () => {
52
+ const original = JSON.parse(JSON.stringify(entry));
53
+
54
+ resolvePlayerTitleSubtitle({
55
+ entry,
56
+ pluginConfiguration: {
57
+ title_data_key_source: "other",
58
+ title_custom_data_key: "extensions.episode_name",
59
+ },
60
+ });
61
+
62
+ expect(entry).toEqual(original);
63
+ });
64
+
65
+ describe("default (mobile) key set", () => {
66
+ it("resolves the title from the default (mobile) custom data key", () => {
67
+ expect(
68
+ resolvePlayerTitleSubtitle({
69
+ entry,
70
+ pluginConfiguration: {
71
+ title_data_key_source: "other",
72
+ title_custom_data_key: "extensions.episode_name",
73
+ },
74
+ })
75
+ ).toEqual({
76
+ title: "Custom Episode",
77
+ summary: "Default Summary",
78
+ });
79
+ });
80
+
81
+ it("ignores TV-only custom data keys", () => {
82
+ expect(
83
+ resolvePlayerTitleSubtitle({
84
+ entry,
85
+ pluginConfiguration: {
86
+ video_player_title_data_key_source: "other",
87
+ video_player_title_custom_data_key: "extensions.episode_name",
88
+ },
89
+ })
90
+ ).toEqual({
91
+ title: "Default Title",
92
+ summary: "Default Summary",
93
+ });
94
+ });
95
+ });
96
+
97
+ describe("dataKeys parameter (e.g. VIDEO_PLAYER_CONTENT_DATA_KEYS)", () => {
98
+ it("resolves the title from the TV video custom data key when dataKeys is VIDEO_PLAYER_CONTENT_DATA_KEYS", () => {
99
+ expect(
100
+ resolvePlayerTitleSubtitle({
101
+ entry,
102
+ pluginConfiguration: {
103
+ video_player_title_data_key_source: "other",
104
+ video_player_title_custom_data_key: "extensions.episode_name",
105
+ video_player_summary_data_key_source: "other",
106
+ video_player_summary_custom_data_key: "extensions.episode_subtitle",
107
+ },
108
+ dataKeys: VIDEO_PLAYER_CONTENT_DATA_KEYS,
109
+ })
110
+ ).toEqual({
111
+ title: "Custom Episode",
112
+ summary: "Custom Subtitle",
113
+ });
114
+ });
115
+
116
+ it("ignores mobile custom data keys when dataKeys is VIDEO_PLAYER_CONTENT_DATA_KEYS", () => {
117
+ expect(
118
+ resolvePlayerTitleSubtitle({
119
+ entry,
120
+ pluginConfiguration: {
121
+ title_data_key_source: "other",
122
+ title_custom_data_key: "extensions.episode_name",
123
+ },
124
+ dataKeys: VIDEO_PLAYER_CONTENT_DATA_KEYS,
125
+ })
126
+ ).toEqual({
127
+ title: "Default Title",
128
+ summary: "Default Summary",
129
+ });
130
+ });
131
+
132
+ it("produces a different resolved title than the default key set for the same configuration object", () => {
133
+ const pluginConfiguration = {
134
+ title_data_key_source: "other",
135
+ title_custom_data_key: "extensions.episode_name",
136
+ video_player_title_data_key_source: "other",
137
+ video_player_title_custom_data_key: "extensions.episode_subtitle",
138
+ };
139
+
140
+ const defaultResolved = resolvePlayerTitleSubtitle({
141
+ entry,
142
+ pluginConfiguration,
143
+ });
144
+
145
+ const tvResolved = resolvePlayerTitleSubtitle({
146
+ entry,
147
+ pluginConfiguration,
148
+ dataKeys: VIDEO_PLAYER_CONTENT_DATA_KEYS,
149
+ });
150
+
151
+ expect(defaultResolved.title).toBe("Custom Episode");
152
+ expect(tvResolved.title).toBe("Custom Subtitle");
153
+ expect(defaultResolved.title).not.toBe(tvResolved.title);
154
+ });
155
+ });
156
+ });
157
+
158
+ describe("getPlayerContentDataKeys", () => {
159
+ it("returns AUDIO_PLAYER_CONTENT_DATA_KEYS for TV audio content", () => {
160
+ expect(getPlayerContentDataKeys({ isTV: true, isAudioContent: true })).toBe(
161
+ AUDIO_PLAYER_CONTENT_DATA_KEYS
162
+ );
163
+ });
164
+
165
+ it("returns VIDEO_PLAYER_CONTENT_DATA_KEYS for TV video content", () => {
166
+ expect(
167
+ getPlayerContentDataKeys({ isTV: true, isAudioContent: false })
168
+ ).toBe(VIDEO_PLAYER_CONTENT_DATA_KEYS);
169
+ });
170
+
171
+ it("returns undefined (the default/mobile key set) on mobile, regardless of content type", () => {
172
+ expect(
173
+ getPlayerContentDataKeys({ isTV: false, isAudioContent: true })
174
+ ).toBeUndefined();
175
+
176
+ expect(
177
+ getPlayerContentDataKeys({ isTV: false, isAudioContent: false })
178
+ ).toBeUndefined();
179
+ });
180
+ });