xref: /expo/apps/test-suite/tests/Constants.js (revision e6258d39)
1'use strict';
2import Constants from 'expo-constants';
3import { Platform } from 'react-native';
4
5export const name = 'Constants';
6
7export function test(t) {
8  t.describe('Constants', () => {
9    ['expoVersion', 'linkingUri'].forEach((v) =>
10      t.it(`can only use ${v} in the managed workflow`, () => {
11        if (
12          Constants.appOwnership === 'expo' ||
13          Constants.appOwnership === 'standalone' ||
14          Platform.OS === 'web'
15        ) {
16          t.expect(Constants[v]).toBeDefined();
17        } else {
18          t.expect(Constants[v]).not.toBeDefined();
19        }
20      })
21    );
22    [
23      'deviceName',
24      'installationId',
25      'isDevice',
26      'sessionId',
27      'manifest',
28      'nativeAppVersion',
29      'nativeBuildVersion',
30    ].forEach((v) =>
31      t.it(`has ${v}`, () => {
32        t.expect(Constants[v]).toBeDefined();
33      })
34    );
35  });
36}
37