1import { createMetadataJson } from '../createMetadataJson';
2
3describe(createMetadataJson, () => {
4  it(`writes metadata without file hashes`, async () => {
5    // Should not throw
6    await createMetadataJson({
7      fileNames: {
8        ios: 'ios-xxfooxxbarxx.js',
9      },
10      bundles: {
11        ios: {
12          assets: [{ type: 'font' } as any],
13        },
14      },
15    });
16  });
17  it(`writes metadata manifest`, async () => {
18    const metadata = await createMetadataJson({
19      fileNames: {
20        ios: 'ios-xxfooxxbarxx.js',
21      },
22      bundles: {
23        ios: {
24          assets: [{ type: 'image', fileHashes: ['foobar', 'other'] } as any],
25        },
26      },
27    });
28
29    expect(metadata).toStrictEqual({
30      bundler: expect.any(String),
31      fileMetadata: {
32        ios: {
33          assets: [
34            {
35              ext: 'image',
36              path: 'assets/foobar',
37            },
38            {
39              ext: 'image',
40              path: 'assets/other',
41            },
42          ],
43          bundle: 'bundles/ios-xxfooxxbarxx.js',
44        },
45      },
46      version: expect.any(Number),
47    });
48  });
49});
50