|
9 | 9 |
|
10 | 10 | (deftest sanitize-source-url-test |
11 | 11 | (testing "HTTPS URL" |
12 | | - (is (= "github.com-nubank-ai-agents-plugins" |
13 | | - (#'plugins/sanitize-source-url "https://github.com/nubank/ai-agents-plugins.git")))) |
| 12 | + (is (= "github.com-my-org-my-plugins" |
| 13 | + (#'plugins/sanitize-source-url "https://github.com/my-org/my-plugins.git")))) |
14 | 14 | (testing "SSH URL" |
15 | | - (is (= "github.com-nubank-ai-agents-plugins" |
16 | | - (#'plugins/sanitize-source-url "git@github.com:nubank/ai-agents-plugins.git")))) |
| 15 | + (is (= "github.com-my-org-my-plugins" |
| 16 | + (#'plugins/sanitize-source-url "git@github.com:my-org/my-plugins.git")))) |
17 | 17 | (testing "GitLab URL" |
18 | 18 | (is (= "gitlab.com-org-repo" |
19 | 19 | (#'plugins/sanitize-source-url "https://gitlab.com/org/repo.git"))))) |
|
135 | 135 |
|
136 | 136 | (deftest parse-sources-test |
137 | 137 | (testing "extracts source entries, filtering install" |
138 | | - (let [config {:nubank {:source "https://github.com/nubank/ai-agents-plugins.git"} |
139 | | - :local {:source "/home/user/plugins"} |
140 | | - :install ["plugin-a" "plugin-b"]}] |
141 | | - (is (match? (m/in-any-order [["nubank" "https://github.com/nubank/ai-agents-plugins.git"] |
| 138 | + (let [config {"my-org" {:source "https://github.com/my-org/my-plugins.git"} |
| 139 | + "local" {:source "/home/user/plugins"} |
| 140 | + "install" ["plugin-a" "plugin-b"]}] |
| 141 | + (is (match? (m/in-any-order [["my-org" "https://github.com/my-org/my-plugins.git"] |
142 | 142 | ["local" "/home/user/plugins"]]) |
143 | 143 | (#'plugins/parse-sources config))))) |
144 | 144 |
|
145 | 145 | (testing "returns empty for no sources" |
146 | | - (is (empty? (#'plugins/parse-sources {:install ["plugin-a"]}))))) |
| 146 | + (is (empty? (#'plugins/parse-sources {"install" ["plugin-a"]}))))) |
147 | 147 |
|
148 | 148 | (deftest resolve-all!-test |
149 | 149 | (let [tmp-dir (fs/create-temp-dir)] |
|
235 | 235 | (let [updated (atom nil)] |
236 | 236 | (with-redefs [eca.config/update-global-config! (fn [c] (reset! updated c))] |
237 | 237 | (let [result (plugins/uninstall-plugin! |
238 | | - {:install ["alpha" "beta" "gamma"]} |
| 238 | + {"install" ["alpha" "beta" "gamma"]} |
239 | 239 | "beta")] |
240 | 240 | (is (= :ok (:status result))) |
241 | 241 | (is (= ["alpha" "gamma"] (get-in @updated [:plugins :install]))))))) |
242 | 242 |
|
243 | 243 | (testing "returns error when plugin is not installed" |
244 | 244 | (let [result (plugins/uninstall-plugin! |
245 | | - {:install ["alpha"]} |
| 245 | + {"install" ["alpha"]} |
246 | 246 | "beta")] |
247 | 247 | (is (= :error (:status result))) |
248 | 248 | (is (re-find #"not installed" (:message result))))) |
249 | 249 |
|
250 | 250 | (testing "returns error when install list is empty" |
251 | 251 | (let [result (plugins/uninstall-plugin! |
252 | | - {:install []} |
| 252 | + {"install" []} |
253 | 253 | "beta")] |
254 | 254 | (is (= :error (:status result)))))) |
0 commit comments