From fddf82eaa7ffbfaa6fa9cd65af1a53cc50417ad5 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Wed, 15 May 2024 14:31:29 +0100 Subject: [PATCH] updatee test assertion --- .../src/components/common/Dropzone.spec.js | 31 +++++++------------ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/packages/builder/src/components/common/Dropzone.spec.js b/packages/builder/src/components/common/Dropzone.spec.js index 6eaf59a3c1..8bf202223b 100644 --- a/packages/builder/src/components/common/Dropzone.spec.js +++ b/packages/builder/src/components/common/Dropzone.spec.js @@ -1,12 +1,11 @@ import { it, expect, describe, vi } from "vitest" import Dropzone from "./Dropzone.svelte" import { render, fireEvent } from "@testing-library/svelte" -import { notifications } from "@budibase/bbui"; +import { notifications } from "@budibase/bbui" import { admin } from "stores/portal" vi.spyOn(notifications, "error").mockImplementation(() => {}) - describe("Dropzone", () => { let instance = null @@ -26,15 +25,13 @@ describe("Dropzone", () => { }) instance = render(Dropzone, { props: { fileSizeLimit: 1000000 } }) // 1MB const fileInput = instance.getByLabelText("Select a file to upload") - const file = new File( - ["hello".repeat(2000000)], - "hello.png", - { - type: "image/png" - } - ) + const file = new File(["hello".repeat(2000000)], "hello.png", { + type: "image/png", + }) await fireEvent.change(fileInput, { target: { files: [file] } }) - expect(notifications.error).toHaveBeenCalledWith("Files cannot exceed 1MB. Please try again with smaller files.") + expect(notifications.error).toHaveBeenCalledWith( + "Files cannot exceed 1MB. Please try again with smaller files." + ) }) it("Ensure the file size error message is not shown when running on self host", async () => { @@ -44,14 +41,10 @@ describe("Dropzone", () => { }) instance = render(Dropzone, { props: { fileSizeLimit: 1000000 } }) // 1MB const fileInput = instance.getByLabelText("Select a file to upload") - const file = new File( - ["hello".repeat(2000000)], - "hello.png", - { - type: "image/png" - } - ) + const file = new File(["hello".repeat(2000000)], "hello.png", { + type: "image/png", + }) await fireEvent.change(fileInput, { target: { files: [file] } }) - expect(notifications.error).not.toHaveBeenCalledWith("Files cannot exceed 1MB. Please try again with smaller files.") + expect(notifications.error).not.toHaveBeenCalled() }) -}) \ No newline at end of file +})