1import nock from 'nock';
2
3import { getExpoApiBaseUrl } from '../endpoint';
4import { getAssetSchemasAsync } from '../getExpoSchema';
5
6beforeAll(() => {
7  process.env.EXPO_NO_CACHE = 'true';
8});
9
10describe(`getAssetSchemasAsync return array of strings including some known values`, () => {
11  beforeAll(() => {
12    nock(getExpoApiBaseUrl())
13      .get('/v2/project/configuration/schema/UNVERSIONED')
14      .reply(200, require('./fixtures/UNVERSIONED.json'));
15    nock(getExpoApiBaseUrl())
16      .get('/v2/project/configuration/schema/44.0.0')
17      .reply(200, require('./fixtures/44.0.0.json'));
18  });
19
20  test.each([
21    [
22      '44.0.0',
23      ['icon', 'notification.icon', 'splash.image', 'ios.splash.xib', 'android.splash.xxhdpi'],
24    ],
25    [
26      'UNVERSIONED',
27      ['icon', 'notification.icon', 'splash.image', 'ios.splash.xib', 'android.splash.xxhdpi'],
28    ],
29  ])('for SDK %s', async (sdkVersion, expectedAssetsPaths) => {
30    const schemas = await getAssetSchemasAsync(sdkVersion);
31    for (const field of schemas) {
32      expect(field).toEqual(expect.any(String));
33    }
34    for (const el of expectedAssetsPaths) {
35      expect(schemas).toContain(el);
36    }
37  });
38});
39