Skip to content

Commit 28d3fee

Browse files
Optimise image utils tests.
1 parent e4bf819 commit 28d3fee

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tests/utils/utils.test.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,29 +62,30 @@ describe("Utilities", () => {
6262
});
6363

6464
describe("Image utilities", () => {
65+
let image;
66+
beforeAll(async () => {
67+
image = await RawImage.fromURL("https://picsum.photos/300/200");
68+
});
69+
6570
it("Read image from URL", async () => {
66-
const image = await RawImage.fromURL("https://picsum.photos/300/200");
6771
expect(image.width).toBe(300);
6872
expect(image.height).toBe(200);
6973
expect(image.channels).toBe(3);
7074
});
7175

7276
it("Can resize image", async () => {
73-
const image = await RawImage.fromURL("https://picsum.photos/300/200");
7477
const resized = await image.resize(150, 100);
7578
expect(resized.width).toBe(150);
7679
expect(resized.height).toBe(100);
7780
});
7881

7982
it("Can resize with aspect ratio", async () => {
80-
const image = await RawImage.fromURL("https://picsum.photos/300/200");
8183
const resized = await image.resize(150, null);
8284
expect(resized.width).toBe(150);
8385
expect(resized.height).toBe(100);
8486
});
8587

8688
it("Returns original image if width and height are null", async () => {
87-
const image = await RawImage.fromURL("https://picsum.photos/300/200");
8889
const resized = await image.resize(null, null);
8990
expect(resized.width).toBe(300);
9091
expect(resized.height).toBe(200);

0 commit comments

Comments
 (0)