xref: /expo/apps/test-suite/tests/Constants.js (revision 2acbb82d)
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      'deviceYearClass',
25      'installationId',
26      'isDevice',
27      'sessionId',
28      'manifest',
29      'nativeAppVersion',
30      'nativeBuildVersion',
31    ].forEach((v) =>
32      t.it(`has ${v}`, () => {
33        t.expect(Constants[v]).toBeDefined();
34      })
35    );
36  });
37}
38