penpot/common/test/common_tests/features_test.cljc
alonso.torres 07ab13d6bc 🔥 Remove the components v1 leftovers
No components v1 file reaches the code any more: opening one fails the
feature check, and imports reject it or give it the feature. What only
served v1 goes:

- validate-file and validate-file-affected no longer skip a file
  without components/v2;
- the root of a deleted component is found by its main instance id
  only, in the type helper and the component sprite;
- generate-sync-library, which synced shapes inside live components,
  and the live components in containers-seq, so asset usages walk the
  pages only (deleted components keep their objects and still sync);
- the unused :components-v2 file option, from the schema, the file
  data and the test fixtures; stored files that carry it still
  validate;
- the team migration-in-progress check and its frontend alert, which
  leaves ephimeral features out of the team comparison;
- the components v2 introduction dialog, its styles and icons, and the
  :v2-info-shown profile prop;
- the graphic asset events and builders and the reads of graphics in
  the selection (the :add-media, :mod-media and :del-media changes stay,
  so stored changes still apply), and the uncalled render-page and
  render-components helpers.

AI-assisted-by: claude-opus-5-5
2026-10-28 15:53:05 +01:00

35 lines
1.5 KiB
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 common-tests.features-test
(:require
[app.common.features :as cfeat]
[clojure.test :as t]))
(defn- incompatibility
"The code of the error raised when moving files between two teams
with the given features, or nil when they are compatible."
[source-features destination-features]
(try
(cfeat/check-teams-compatibility! {:features source-features}
{:features destination-features})
nil
(catch #?(:clj Exception :cljs :default) cause
(:code (ex-data cause)))))
(t/deftest teams-with-the-same-features-are-compatible
(t/is (nil? (incompatibility cfeat/default-features cfeat/default-features))))
(t/deftest a-feature-only-one-team-has-makes-them-incompatible
(let [features (conj cfeat/default-features "test/unknown")]
(t/is (= :team-feature-mismatch (incompatibility features cfeat/default-features)))
(t/is (= :team-feature-mismatch (incompatibility cfeat/default-features features)))))
(t/deftest ephimeral-features-left-on-a-team-are-ignored
(let [features (conj cfeat/default-features "ephimeral/migration")]
(t/is (nil? (incompatibility features cfeat/default-features)))
(t/is (nil? (incompatibility cfeat/default-features features)))))