Skip to content
This repository was archived by the owner on Jul 26, 2025. It is now read-only.

Commit 835b932

Browse files
committed
fix: resolve conversations
close: #297
1 parent fe0718d commit 835b932

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

src/load/__tests__/fetchURL.test.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { encodeDataURL } from '../../save/encodeDataURL.js';
22
import { fetchURL } from '../fetchURL.js';
33

44
describe('testing fetchURL', () => {
5-
test('basic test 1', async () => {
5+
test('decodes image from data URL', async () => {
66
const image = await fetchURL(
77
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAAAAACoBHk5AAAAFklEQVR4XmNggID///+DSCCEskHM/wCAnQr2TY5mOAAAAABJRU5ErkJggg==',
88
);
@@ -21,10 +21,4 @@ describe('testing fetchURL', () => {
2121
const result = encodeDataURL(image);
2222
expect(result).toEqual(dataURL);
2323
});
24-
test('decode from an image url', async () => {
25-
const image = await fetchURL('https://picsum.photos/id/237/150/200');
26-
expect(image.width).toEqual(150);
27-
expect(image.height).toEqual(200);
28-
expect(image.bitDepth).toEqual(8);
29-
});
3024
});

src/load/fetchURL.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ import { decode } from './decode.js';
88
export async function fetchURL(dataUrl: string) {
99
const response = await fetch(dataUrl);
1010
const arrayBuffer = await response.arrayBuffer();
11-
const image = decode(new Uint8Array(arrayBuffer));
11+
const image = decode(new DataView(arrayBuffer));
1212
return image;
1313
}

0 commit comments

Comments
 (0)