Fix issues with develop and serve (#24602)

* fix issues with develop and serve

* fix get image data, use hassUrl

* save picture-upload

* Update bundje.cjs

* Prettier

* Fix profile picture in dev serve mode

* person badge too

---------

Co-authored-by: Wendelin <w@pe8.at>
This commit is contained in:
Bram Kragten
2025-03-12 16:59:40 +01:00
committed by GitHub
parent 1e000d2740
commit dda7de3301
15 changed files with 54 additions and 43 deletions

View File

@ -128,12 +128,15 @@ describe("image_upload", () => {
});
describe("getImageData", () => {
const hass = {
hassUrl: vi.fn((url) => url),
} as unknown as HomeAssistant;
it("should fetch image data", async () => {
global.fetch = vi.fn().mockResolvedValue({
ok: true,
blob: vi.fn().mockResolvedValue(new Blob()),
});
const data = await getImageData("http://example.com/image.png");
const data = await getImageData(hass, "http://example.com/image.png");
expect(global.fetch).toHaveBeenCalledWith("http://example.com/image.png");
expect(data).toBeInstanceOf(Blob);
});
@ -143,7 +146,7 @@ describe("image_upload", () => {
.fn()
.mockResolvedValue({ ok: false, statusText: "Not Found" });
await expect(
getImageData("http://example.com/image.png")
getImageData(hass, "http://example.com/image.png")
).rejects.toThrow("Failed to fetch image: Not Found");
});
});