penpot/frontend/test/frontend_tests/ui/delete_shared_test.cljs
alonso.torres 934cdb8532 🐛 List each file once when deleting libraries it uses
Deleting or unpublishing several libraries at once listed a file that
uses more than one of them once per library, and React logged a
duplicate key error for the repeated rows. The references of each
library were joined without removing repeated files.

The dialog now lists each file once (`distinct-references`).

Found by the components Qase run (PENPOT-1473).

Test: `delete-shared-test`.

AI-assisted-by: claude-opus-5-5
2026-11-19 09:59:16 +01:00

21 lines
764 B
Clojure

;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) KALEIDOS SUBSIDIARY SL
(ns frontend-tests.ui.delete-shared-test
(:require
[app.common.uuid :as uuid]
[app.main.ui.delete-shared :as delete-shared]
[cljs.test :as t :include-macros true]))
(def ^:private distinct-references
@#'delete-shared/distinct-references)
(t/deftest a-file-using-several-of-the-libraries-is-listed-once
(let [file-a (uuid/next)
file-b (uuid/next)]
(t/is (= [[file-a "File A"] [file-b "File B"]]
(distinct-references [[file-a "File A"] [file-b "File B"] [file-a "File A"]])))))