mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-22 08:24:44 +03:00
fix: add prefer-blob-reading-methods rule (#5118)
This commit is contained in:
parent
cb2c659f52
commit
eadf8a085b
@ -212,6 +212,7 @@ const config = {
|
||||
'unicorn/prefer-dom-node-remove': 'error',
|
||||
'unicorn/prefer-array-some': 'error',
|
||||
'unicorn/prefer-date-now': 'error',
|
||||
'unicorn/prefer-blob-reading-methods': 'error',
|
||||
'unicorn/no-typeof-undefined': 'error',
|
||||
'unicorn/no-useless-promise-resolve-reject': 'error',
|
||||
'unicorn/no-new-array': 'error',
|
||||
|
@ -368,18 +368,10 @@ test('can sync svg between different browsers', async ({ page, browser }) => {
|
||||
expect(src).not.toBeNull();
|
||||
|
||||
// fetch the src resource in the browser
|
||||
const svg2 = await page2.evaluate(async src => {
|
||||
async function blobToString(blob: Blob) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
reader.onloadend = () => resolve(reader.result);
|
||||
reader.onerror = reject;
|
||||
reader.readAsText(blob);
|
||||
});
|
||||
}
|
||||
|
||||
const blob = fetch(src!).then(res => res.blob());
|
||||
return blobToString(await blob);
|
||||
const svg2 = await page2.evaluate(src => {
|
||||
return fetch(src!)
|
||||
.then(res => res.blob())
|
||||
.then(blob => blob.text());
|
||||
}, src);
|
||||
|
||||
// turn the blob into string and check if it contains the svg
|
||||
|
Loading…
Reference in New Issue
Block a user