1import { copyAsync } from '../../utils/dir'; 2import { saveAssetsAsync } from '../saveAssets'; 3 4jest.mock('../../log'); 5 6jest.mock('../../utils/dir', () => ({ 7 copyAsync: jest.fn(), 8})); 9 10describe(saveAssetsAsync, () => { 11 it(`copy assets into directory`, async () => { 12 await saveAssetsAsync('/', { 13 outputDir: 'output', 14 assets: [ 15 { 16 __packager_asset: true, 17 files: ['/icon.png', '/[email protected]'], 18 hash: '4e3f888fc8475f69fd5fa32f1ad5216a', 19 name: 'icon', 20 type: 'png', 21 fileHashes: ['4e3f888fc8475f69fd5fa32f1ad5216a', 'hash-2'], 22 }, 23 ], 24 }); 25 26 expect(copyAsync).toBeCalledTimes(2); 27 expect(copyAsync).toHaveBeenNthCalledWith( 28 1, 29 '/icon.png', 30 'output/assets/4e3f888fc8475f69fd5fa32f1ad5216a' 31 ); 32 expect(copyAsync).toHaveBeenNthCalledWith(2, '/[email protected]', 'output/assets/hash-2'); 33 }); 34}); 35