@applicaster/zapp-react-native-utils 16.0.0-rc.69 → 16.0.0-rc.70

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.
@@ -0,0 +1,38 @@
1
+ import { PlayerNative } from "../playerNative";
2
+
3
+ const playerWithEntry = (entry: any) =>
4
+ new PlayerNative({
5
+ entry,
6
+ player: null as any,
7
+ playerId: "test-player",
8
+ });
9
+
10
+ describe("PlayerNative.isAudioItem", () => {
11
+ it.each(["audio", "audio-player", "audio-detail", "audio-show", "audio-hub"])(
12
+ "treats the %s content type as audio",
13
+ (type) => {
14
+ expect(playerWithEntry({ type: { value: type } }).isAudioItem()).toBe(
15
+ true
16
+ );
17
+ }
18
+ );
19
+
20
+ it.each(["video", "video-detail", "comic-detail", "article-show"])(
21
+ "does not treat the %s content type as audio",
22
+ (type) => {
23
+ expect(playerWithEntry({ type: { value: type } }).isAudioItem()).toBe(
24
+ false
25
+ );
26
+ }
27
+ );
28
+
29
+ it("falls back to the media type when the content type says nothing", () => {
30
+ const entry = { content: { type: "audio/mpeg" }, type: { value: "link" } };
31
+
32
+ expect(playerWithEntry(entry).isAudioItem()).toBe(true);
33
+ });
34
+
35
+ it("returns false when there is no entry", () => {
36
+ expect(playerWithEntry(null).isAudioItem()).toBe(false);
37
+ });
38
+ });
@@ -296,9 +296,11 @@ export class PlayerNative extends Player {
296
296
  }, listeners);
297
297
  };
298
298
 
299
- isAudioItem = () =>
300
- this.getEntry()?.content?.type?.includes?.("audio") ||
301
- this.getEntry()?.type?.value === "audio";
299
+ isAudioItem = (): boolean =>
300
+ Boolean(
301
+ this.getEntry()?.content?.type?.includes?.("audio") ||
302
+ this.getEntry()?.type?.value?.includes?.("audio")
303
+ );
302
304
 
303
305
  isFullScreenSupported = (): boolean => {
304
306
  const config = this.getConfig();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "16.0.0-rc.69",
3
+ "version": "16.0.0-rc.70",
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": "16.0.0-rc.69",
30
+ "@applicaster/applicaster-types": "16.0.0-rc.70",
31
31
  "buffer": "^5.2.1",
32
32
  "camelize": "^1.0.0",
33
33
  "dayjs": "^1.11.10",