From e49237c203906c28d2dd8b896f59d5e2ff870ed8 Mon Sep 17 00:00:00 2001 From: Wes Morgan Date: Mon, 12 Sep 2022 12:28:42 -0600 Subject: [PATCH] Add a test for CLJ API delete-ledger-async fn ...which is failing in this commit. Next commit fixes it. --- test/fluree/db/ledger/api/downloaded.clj | 34 +++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/test/fluree/db/ledger/api/downloaded.clj b/test/fluree/db/ledger/api/downloaded.clj index 680d0f84..2a0296b9 100644 --- a/test/fluree/db/ledger/api/downloaded.clj +++ b/test/fluree/db/ledger/api/downloaded.clj @@ -1,6 +1,6 @@ (ns fluree.db.ledger.api.downloaded (:require [clojure.test :refer :all] - [clojure.core.async :as async] + [clojure.core.async :as async :refer [ res :body bs/to-string json/parse)] (is (= 200 (:status res))) + (is (= ledger-id (:deleted body))))))) + (testing "deprecated delete-db cmd still works" + (let [network "deleteme" + db-id "two" + ledger-id (str network "/" db-id) + new-db-res @(http/post (str endpoint-url-short "new-ledger") + (standard-request {:db/id ledger-id})) + new-db-body (-> new-db-res :body bs/to-string json/parse)] + (is (= 200 (:status new-db-res))) + (is (string? new-db-body)) + (is (= 64 (count new-db-body))) + (when (wait-for-db network db-id 100) + (let [res @(http/post (str endpoint-url-short "delete-db") + (standard-request {:db/id ledger-id})) + body (some-> res :body bs/to-string json/parse)] + (is (= 200 (:status res))) (is (= ledger-id (:deleted body)))))))) ;; TODO - can't test this with other tests - fails. Can't have any txns processed between gen-flakes and query-with. Not sure how to make sure of that. Running the independent version succeeds. @@ -736,6 +767,7 @@ (test-gen-flakes-query-transact-with)) (deftest api-test + (clj-delete-ledger-test) (add-schema*) (new-people-comments-chats-auth) (query-all-collections)