Merge branch 'develop' into webp-avif

This commit is contained in:
Gaël Métais
2023-10-06 16:43:32 +02:00
committed by GitHub
11 changed files with 163 additions and 49 deletions
+5 -5
View File
@@ -10,11 +10,11 @@ describe('contentTypeChecker', function() {
var svgImageContent = fs.readFileSync(path.resolve(__dirname, '../www/svg-image.svg'));
var cssFileContent = fs.readFileSync(path.resolve(__dirname, '../www/unminified-stylesheet.css'));
it('detect the right content type', async function() {
(await contentTypeChecker.findContentType(jpgImageContent)).mimes.should.deep.equal(['image/jpeg']);
(await contentTypeChecker.findContentType(pngImageContent)).mimes.should.deep.equal(['image/png']);
(await contentTypeChecker.findContentType(svgImageContent)).mimes.should.deep.equal(['image/svg+xml']);
should.equal(await contentTypeChecker.findContentType(cssFileContent), null);
it('detect the right content type', function() {
contentTypeChecker.findContentType(jpgImageContent).mimes.should.deep.equal(['image/jpeg']);
contentTypeChecker.findContentType(pngImageContent).mimes.should.deep.equal(['image/png']);
contentTypeChecker.findContentType(svgImageContent).mimes.should.deep.equal(['image/svg+xml']);
should.equal(contentTypeChecker.findContentType(cssFileContent), null);
});
});
+10 -1
View File
@@ -160,9 +160,18 @@ describe('redownload', function() {
redownload.redownloadEntry(entry)
.then(function(newEntry) {
newEntry.weightCheck.bodySize.should.equal(4193);
newEntry.weightCheck.bodyBuffer.should.deep.equal(fileContent);
done();
// Opening the image in jimp to check if the format is good
var Jimp = require('jimp');
Jimp.read(newEntry.weightCheck.bodyBuffer, function(err, image) {
image.bitmap.width.should.equal(620);
image.bitmap.height.should.equal(104);
done(err);
});
})
.fail(function(err) {
Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB