Skip to content

Commit

Permalink
correct hash names
Browse files Browse the repository at this point in the history
  • Loading branch information
aarbi committed Nov 10, 2021
1 parent c802616 commit 721ac5a
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions test/features/mix.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import File from '../../src/File.js';
import { mix } from '../helpers/mix.js';
import webpack from '../helpers/webpack.js';

import fs from 'fs-extra';

test.beforeEach(() => webpack.setupVueAliases(2));

test('the kitchen sink', async t => {
Expand Down Expand Up @@ -52,23 +54,30 @@ test('it resolves image- and font-urls and distinguishes between them even if we
// When we compile it
await webpack.compile();

console.log('images generated', await fs.readdir('test/fixtures/app/dist/images/'));
console.log('fonts generated', await fs.readdir('test/fixtures/app/dist/fonts/'));

// Then we expect the css to be built
t.true(File.exists(`test/fixtures/app/dist/css/font-and-image.css`));
// Along with the referred image in the images folder
t.true(File.exists(`test/fixtures/app/dist/images/img.66162.svg`));
t.true(File.exists(`test/fixtures/app/dist/images/img.66162863.svg`));
// And the referred fonts in the fonts folder
t.true(File.exists(`test/fixtures/app/dist/fonts/font.svg`));
t.true(File.exists(`test/fixtures/app/dist/fonts/awesome.svg`));
// And we expect the image NOT to be in the fonts folder:
t.false(File.exists(`test/fixtures/app/dist/fonts/img.svg`));
// And the fonts NOT to be in the image folder
t.false(File.exists(`test/fixtures/app/dist/images/font.66162.svg`));
t.false(File.exists(`test/fixtures/app/dist/images/awesome.66162.svg`));
t.false(File.exists(`test/fixtures/app/dist/images/font.66162863.svg`));
t.false(File.exists(`test/fixtures/app/dist/images/awesome.66162863.svg`));
});

test('it accepts images with the same file name but with different paths', async t => {
mix.js(`test/fixtures/app/src/js/app-import-images-same-file-name.js`, 'js');
await webpack.compile();
t.true(File.exists(`test/fixtures/app/dist/images/img.66162.svg`));
t.true(File.exists(`test/fixtures/app/dist/images/img.9e0d3.svg`));
const files = await fs.readdir('test/fixtures/app/dist/images/');

console.log('images generated', files);

t.true(File.exists(`test/fixtures/app/dist/images/img.66162863.svg`));
t.true(File.exists(`test/fixtures/app/dist/images/img.9e0d380b.svg`));
});

0 comments on commit 721ac5a

Please sign in to comment.