refactor: migrate lqip-loader to TS, fix typing for Webpack Loaders (#5779)

This commit is contained in:
Joshua Chen 2021-10-27 22:38:11 +08:00 committed by GitHub
parent ca5d70d7fb
commit 68c970175a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 254 additions and 265 deletions

View file

@ -10,14 +10,14 @@ import Vibrant from 'node-vibrant';
import {Palette} from 'node-vibrant/lib/color';
import {toPalette, toBase64} from '../utils';
import lqip from '../lqip';
import * as lqip from '../lqip';
describe('lqip-loader', () => {
describe('toBase64', () => {
test('should return a properly formatted Base64 image string', () => {
const expected = 'data:image/jpeg;base64,hello world';
const expected = 'data:image/jpeg;base64,aGVsbG8gd29ybGQ=';
const mockedMimeType = 'image/jpeg';
const mockedBase64Data = 'hello world';
const mockedBase64Data = Buffer.from('hello world');
expect(toBase64(mockedMimeType, mockedBase64Data)).toEqual(expected);
});
});