Skip to content

Commit

Permalink
Fix rescale paths
Browse files Browse the repository at this point in the history
  • Loading branch information
steve-lebleu committed Mar 13, 2021
1 parent fea5621 commit ffbeecf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/api/services/media.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Media } from '@models/media.model';
import { SCALING } from '@config/environment.config';
import { IMAGE_MIME_TYPE } from '@enums/mime-type.enum';

const SIZES = Object.keys(SCALING.SIZES).map(key => key);
const SIZES = Object.keys(SCALING.SIZES).map(key => key.toLowerCase());

/**
* @description
Expand Down
4 changes: 2 additions & 2 deletions test/units/03-services.unit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ describe('Services', () => {
it('should remove all scaled images', () => {
const image = fixtures.media.image({id:1});
fs.copyFileSync(`${process.cwd()}/test/utils/fixtures/files/${image.filename}`, `${process.cwd()}/dist/public/images/master-copy/${image.filename}`);
['XS', 'SM', 'MD', 'LG', 'XL'].forEach(size => {
['xs', 'sm', 'md', 'lg', 'xl'].forEach(size => {
fs.copyFileSync(`${process.cwd()}/test/utils/fixtures/files/${image.filename}`, `${process.cwd()}/dist/public/images/rescale/${size}/${image.filename}`);
});
remove(fixtures.media.image({id:1}));
setTimeout(() => {
expect(fs.existsSync(`${process.cwd()}/dist/public/images/master-copy/${image.filename}`)).to.be.false;
['XS', 'SM', 'MD', 'LG', 'XL'].forEach(size => {
['xs', 'sm', 'md', 'lg', 'xl'].forEach(size => {
expect(fs.existsSync(`${process.cwd()}/dist/public/images/rescale/${size}/${image.filename}`)).to.be.false;
});
done();
Expand Down

0 comments on commit ffbeecf

Please sign in to comment.