From b50076409f59493cdf4274a235d82cacf03ff9e8 Mon Sep 17 00:00:00 2001 From: Dion Date: Thu, 24 Oct 2024 16:19:41 +0200 Subject: [PATCH 1/3] add support for okAndSame status --- .../item-text-list-view.spec.tsx | 18 ++++++++++++++++++ .../item-text-list-view.tsx | 10 +++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/starsky/starsky/clientapp/src/components/molecules/item-text-list-view/item-text-list-view.spec.tsx b/starsky/starsky/clientapp/src/components/molecules/item-text-list-view/item-text-list-view.spec.tsx index ae7d008749..1febbb0753 100644 --- a/starsky/starsky/clientapp/src/components/molecules/item-text-list-view/item-text-list-view.spec.tsx +++ b/starsky/starsky/clientapp/src/components/molecules/item-text-list-view/item-text-list-view.spec.tsx @@ -45,6 +45,24 @@ describe("ItemTextListView", () => { ); }); + it("list of no error item", () => { + const fileIndexItems = [ + { + filePath: "/test/image.jpg", + fileName: "image.jpg", + status: IExifStatus.ServerError, + isDirectory: false + } + ] as IFileIndexItem[]; + const list = render( {}} />); + + const item = screen.getByTestId("image.jpg-error-status"); + + expect(item).toBeFalsy(); + + list.unmount(); + }); + it("list of 1 directory item", () => { const fileIndexItems = [ { diff --git a/starsky/starsky/clientapp/src/components/molecules/item-text-list-view/item-text-list-view.tsx b/starsky/starsky/clientapp/src/components/molecules/item-text-list-view/item-text-list-view.tsx index 284244633e..e0b688d727 100644 --- a/starsky/starsky/clientapp/src/components/molecules/item-text-list-view/item-text-list-view.tsx +++ b/starsky/starsky/clientapp/src/components/molecules/item-text-list-view/item-text-list-view.tsx @@ -1,9 +1,9 @@ +import { FunctionComponent } from "react"; import useGlobalSettings from "../../../hooks/use-global-settings"; import { IExifStatus } from "../../../interfaces/IExifStatus"; import { IFileIndexItem } from "../../../interfaces/IFileIndexItem"; import localization from "../../../localization/localization.json"; import { Language } from "../../../shared/language"; -import { FunctionComponent } from "react"; import { GetBoxClassName } from "./internal/get-box-class-name.ts"; interface ItemListProps { @@ -51,8 +51,12 @@ const ItemTextListView: FunctionComponent = (props) => { ) : null} {!item.isDirectory ? item.fileName : null} - {item.status !== IExifStatus.Ok && item.status !== IExifStatus.Default ? ( - {item.status} + {item.status !== IExifStatus.Ok && + item.status !== IExifStatus.Default && + item.status !== IExifStatus.OkAndSame ? ( + + {item.status} + ) : null} ))} From 66797364f1f7a856f966ee5ee93f3656232a48c7 Mon Sep 17 00:00:00 2001 From: Dion Date: Thu, 24 Oct 2024 16:24:02 +0200 Subject: [PATCH 2/3] add extra tests --- .../item-text-list-view.spec.tsx | 45 ++++++++++++------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/starsky/starsky/clientapp/src/components/molecules/item-text-list-view/item-text-list-view.spec.tsx b/starsky/starsky/clientapp/src/components/molecules/item-text-list-view/item-text-list-view.spec.tsx index 1febbb0753..7bd31401f6 100644 --- a/starsky/starsky/clientapp/src/components/molecules/item-text-list-view/item-text-list-view.spec.tsx +++ b/starsky/starsky/clientapp/src/components/molecules/item-text-list-view/item-text-list-view.spec.tsx @@ -45,23 +45,38 @@ describe("ItemTextListView", () => { ); }); - it("list of no error item", () => { - const fileIndexItems = [ - { - filePath: "/test/image.jpg", - fileName: "image.jpg", - status: IExifStatus.ServerError, - isDirectory: false + const statusCorrectlyTheoryData = [ + { status: IExifStatus.OkAndSame, shouldShowError: false }, + { status: IExifStatus.ServerError, shouldShowError: true }, + { status: IExifStatus.NotFoundSourceMissing, shouldShowError: true }, + { status: IExifStatus.Ok, shouldShowError: false }, + { status: IExifStatus.ReadOnly, shouldShowError: true } + ]; + + test.each(statusCorrectlyTheoryData)( + "error-status should render %s", + ({ status, shouldShowError }) => { + const fileIndexItems = [ + { + filePath: "/test/image.jpg", + fileName: "image.jpg", + status: status, + isDirectory: false + } + ] as IFileIndexItem[]; + const list = render( {}} />); + + const item = screen.queryByTestId("image.jpg-error-status"); + + if (shouldShowError) { + expect(item).toBeTruthy(); + } else { + expect(item).toBeFalsy(); } - ] as IFileIndexItem[]; - const list = render( {}} />); - - const item = screen.getByTestId("image.jpg-error-status"); - expect(item).toBeFalsy(); - - list.unmount(); - }); + list.unmount(); + } + ); it("list of 1 directory item", () => { const fileIndexItems = [ From 0e4da05fe378f47ddada7b568165cc5d20a88d42 Mon Sep 17 00:00:00 2001 From: Dion Date: Thu, 24 Oct 2024 16:26:48 +0200 Subject: [PATCH 3/3] keep a changelog --- history.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/history.md b/history.md index d1468b00a0..874aec2539 100644 --- a/history.md +++ b/history.md @@ -42,7 +42,8 @@ Semantic Versioning 2.0.0 is from version 0.1.6+ ## List of versions ## version 0.6.3 - _(Unreleased)_ - 2024-08-?? {#v0.6.3} -- nothing + +- [x] (Fixed) _Front-end_ OkAndSame status in Upload Modal gives the wrong status (PR #1783) ## version 0.6.2 - 2024-10-11 {#v0.6.2}