UNPKG

981 BPlain TextView Raw
1import { getReactNativeVersionWithModules } from "./getReactNativeVersionWithModules"
2
3describe("getReactNativeVersion", () => {
4 it("should return null if platform constants is null", () => {
5 const result = getReactNativeVersionWithModules({})
6
7 expect(result).toBe(null)
8 })
9
10 it("should return null if there is no reactNativeVersion on platform constants", () => {
11 const result = getReactNativeVersionWithModules({ PlatformConstants: {} })
12
13 expect(result).toBe(null)
14 })
15
16 it("should return null if the major version is not a number", () => {
17 const result = getReactNativeVersionWithModules({
18 PlatformConstants: { reactNativeVersion: { major: "Hello" } },
19 })
20
21 expect(result).toBe(null)
22 })
23
24 it("should return a version", () => {
25 const result = getReactNativeVersionWithModules({
26 PlatformConstants: { reactNativeVersion: { major: 0, minor: 59, patch: 8, prerelease: 5 } },
27 })
28
29 expect(result).toEqual("0.59.8-5")
30 })
31})