Fix test (#6733)
This commit is contained in:
		@@ -15,8 +15,9 @@ import { getFileInfo } from '../src/misc/get-file-info';
 | 
			
		||||
describe('Get file info', () => {
 | 
			
		||||
	it('Empty file', async (async () => {
 | 
			
		||||
		const path = `${__dirname}/resources/emptyfile`;
 | 
			
		||||
		const info = await getFileInfo(path);
 | 
			
		||||
		const info = await getFileInfo(path) as any;
 | 
			
		||||
		delete info.warnings;
 | 
			
		||||
		delete info.blurhash;
 | 
			
		||||
		assert.deepStrictEqual(info, {
 | 
			
		||||
			size: 0,
 | 
			
		||||
			md5: 'd41d8cd98f00b204e9800998ecf8427e',
 | 
			
		||||
@@ -26,14 +27,14 @@ describe('Get file info', () => {
 | 
			
		||||
			},
 | 
			
		||||
			width: undefined,
 | 
			
		||||
			height: undefined,
 | 
			
		||||
			blurhash: undefined
 | 
			
		||||
		});
 | 
			
		||||
	}));
 | 
			
		||||
 | 
			
		||||
	it('Generic JPEG', async (async () => {
 | 
			
		||||
		const path = `${__dirname}/resources/Lenna.jpg`;
 | 
			
		||||
		const info = await getFileInfo(path);
 | 
			
		||||
		const info = await getFileInfo(path) as any;
 | 
			
		||||
		delete info.warnings;
 | 
			
		||||
		delete info.blurhash;
 | 
			
		||||
		assert.deepStrictEqual(info, {
 | 
			
		||||
			size: 25360,
 | 
			
		||||
			md5: '091b3f259662aa31e2ffef4519951168',
 | 
			
		||||
@@ -43,14 +44,14 @@ describe('Get file info', () => {
 | 
			
		||||
			},
 | 
			
		||||
			width: 512,
 | 
			
		||||
			height: 512,
 | 
			
		||||
			blurhash: 'yFLxJjH[NE}@^PRiN_}Y=aVZNvFxxZ#SwIt7Eg%KIp-ospv~Nex[R6t3xZI:iwt6kWxDafoySgsAfR$*oyM|S2t7$iV[tQNbaKn%xt'
 | 
			
		||||
		});
 | 
			
		||||
	}));
 | 
			
		||||
 | 
			
		||||
	it('Generic APNG', async (async () => {
 | 
			
		||||
		const path = `${__dirname}/resources/anime.png`;
 | 
			
		||||
		const info = await getFileInfo(path);
 | 
			
		||||
		const info = await getFileInfo(path) as any;
 | 
			
		||||
		delete info.warnings;
 | 
			
		||||
		delete info.blurhash;
 | 
			
		||||
		assert.deepStrictEqual(info, {
 | 
			
		||||
			size: 1868,
 | 
			
		||||
			md5: '08189c607bea3b952704676bb3c979e0',
 | 
			
		||||
@@ -60,14 +61,14 @@ describe('Get file info', () => {
 | 
			
		||||
			},
 | 
			
		||||
			width: 256,
 | 
			
		||||
			height: 256,
 | 
			
		||||
			blurhash: 'y8S?Mr-;=~~Xs;%foL?bWVs;xbR%NFay^ms;I-InI-xbs;%gofj[I-s;-WxbI-WUayxb$,NFR*~Wa{R%xbayNFI.oMj[oMNFWB$,WU'
 | 
			
		||||
		});
 | 
			
		||||
	}));
 | 
			
		||||
 | 
			
		||||
	it('Generic AGIF', async (async () => {
 | 
			
		||||
		const path = `${__dirname}/resources/anime.gif`;
 | 
			
		||||
		const info = await getFileInfo(path);
 | 
			
		||||
		const info = await getFileInfo(path) as any;
 | 
			
		||||
		delete info.warnings;
 | 
			
		||||
		delete info.blurhash;
 | 
			
		||||
		assert.deepStrictEqual(info, {
 | 
			
		||||
			size: 2248,
 | 
			
		||||
			md5: '32c47a11555675d9267aee1a86571e7e',
 | 
			
		||||
@@ -77,14 +78,14 @@ describe('Get file info', () => {
 | 
			
		||||
			},
 | 
			
		||||
			width: 256,
 | 
			
		||||
			height: 256,
 | 
			
		||||
			blurhash: 'y8S?Mr-;=~~Xs;%foL?bWVs;xbR%NFay^ms;I-InI-xbs;%gofj[I-s;-WxbI-WUayxb$,NFR*~Wa{R%xbayNFI.oMj[oMNFWB$,WU'
 | 
			
		||||
		});
 | 
			
		||||
	}));
 | 
			
		||||
 | 
			
		||||
	it('PNG with alpha', async (async () => {
 | 
			
		||||
		const path = `${__dirname}/resources/with-alpha.png`;
 | 
			
		||||
		const info = await getFileInfo(path);
 | 
			
		||||
		const info = await getFileInfo(path) as any;
 | 
			
		||||
		delete info.warnings;
 | 
			
		||||
		delete info.blurhash;
 | 
			
		||||
		assert.deepStrictEqual(info, {
 | 
			
		||||
			size: 3772,
 | 
			
		||||
			md5: 'f73535c3e1e27508885b69b10cf6e991',
 | 
			
		||||
@@ -94,14 +95,14 @@ describe('Get file info', () => {
 | 
			
		||||
			},
 | 
			
		||||
			width: 256,
 | 
			
		||||
			height: 256,
 | 
			
		||||
			blurhash: 'y74P29kDpdp{k?VDZ#krkCaefkf6fQf5HXZ$krkqadaKaJkCaKkXfkkCf5fkQ8kXZ#VDaKk?krZ~kCf6kDf6f5f6U]krZ#Z#aekrkq'
 | 
			
		||||
		});
 | 
			
		||||
	}));
 | 
			
		||||
 | 
			
		||||
	it('Generic SVG', async (async () => {
 | 
			
		||||
		const path = `${__dirname}/resources/image.svg`;
 | 
			
		||||
		const info = await getFileInfo(path);
 | 
			
		||||
		const info = await getFileInfo(path) as any;
 | 
			
		||||
		delete info.warnings;
 | 
			
		||||
		delete info.blurhash;
 | 
			
		||||
		assert.deepStrictEqual(info, {
 | 
			
		||||
			size: 505,
 | 
			
		||||
			md5: 'b6f52b4b021e7b92cdd04509c7267965',
 | 
			
		||||
@@ -111,15 +112,15 @@ describe('Get file info', () => {
 | 
			
		||||
			},
 | 
			
		||||
			width: 256,
 | 
			
		||||
			height: 256,
 | 
			
		||||
			blurhash: 'yMEKyd1U1?=nZN-2EwofR*oHnijYX6S50J=m]WEVl9JE$SR*xHR;XSX8nQxB-WS6Nts*aKskWnaxR%s*i_n~X6S5=#NgOAs*enoIWU'
 | 
			
		||||
		});
 | 
			
		||||
	}));
 | 
			
		||||
 | 
			
		||||
	it('SVG with XML definition', async (async () => {
 | 
			
		||||
		// https://github.com/syuilo/misskey/issues/4413
 | 
			
		||||
		const path = `${__dirname}/resources/with-xml-def.svg`;
 | 
			
		||||
		const info = await getFileInfo(path);
 | 
			
		||||
		const info = await getFileInfo(path) as any;
 | 
			
		||||
		delete info.warnings;
 | 
			
		||||
		delete info.blurhash;
 | 
			
		||||
		assert.deepStrictEqual(info, {
 | 
			
		||||
			size: 544,
 | 
			
		||||
			md5: '4b7a346cde9ccbeb267e812567e33397',
 | 
			
		||||
@@ -129,14 +130,14 @@ describe('Get file info', () => {
 | 
			
		||||
			},
 | 
			
		||||
			width: 256,
 | 
			
		||||
			height: 256,
 | 
			
		||||
			blurhash: 'yMEKyd1U1?=nZN-2EwofR*oHnijYX6S50J=m]WEVl9JE$SR*xHR;XSX8nQxB-WS6Nts*aKskWnaxR%s*i_n~X6S5=#NgOAs*enoIWU'
 | 
			
		||||
		});
 | 
			
		||||
	}));
 | 
			
		||||
 | 
			
		||||
	it('Dimension limit', async (async () => {
 | 
			
		||||
		const path = `${__dirname}/resources/25000x25000.png`;
 | 
			
		||||
		const info = await getFileInfo(path);
 | 
			
		||||
		const info = await getFileInfo(path) as any;
 | 
			
		||||
		delete info.warnings;
 | 
			
		||||
		delete info.blurhash;
 | 
			
		||||
		assert.deepStrictEqual(info, {
 | 
			
		||||
			size: 75933,
 | 
			
		||||
			md5: '268c5dde99e17cf8fe09f1ab3f97df56',
 | 
			
		||||
@@ -146,7 +147,6 @@ describe('Get file info', () => {
 | 
			
		||||
			},
 | 
			
		||||
			width: 25000,
 | 
			
		||||
			height: 25000,
 | 
			
		||||
			blurhash: undefined
 | 
			
		||||
		});
 | 
			
		||||
	}));
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user