mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-16 16:32:09 +00:00
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:
@ -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");
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user