                                 4 {:id 4 :page 1}}}
 
         shape (get-in initial [:shapes 4])
-        expected (-> initial
-                     (assoc-in [:pages 1 :shapes] [1 3])
-                     (update-in [:shapes] dissoc 4))
+        expected {:pages {1 {:id 1 :shapes [1 3]}}
+                  :shapes {1 {:id 1 :page 1 :type :group :items [2]}
+                           2 {:id 2 :page 1 :group 1}
+                           3 {:id 3 :page 1}}}
+
         result (impl/dissoc-shape initial shape)]
     ;; (pprint expected)
     ;; (pprint result)

                          2 {:id 2 :page 1 :type :group :items [3] :group 1}
                          3 {:id 3 :page 1 :group 2}}}

        expected {:pages {1 {:id 1, :shapes [1]}},
                  :shapes {1 {:id 1, :page 1, :type :group, :items [3]},
                           3 {:id 3, :page 1, :group 1}},
                  :workspace {:selected #{3}}}]
    (let [result (impl/degroup-shapes initial [2] 1)]
      ;; (pprint expected)

                                2 {:id 2 :page 1}
                                3 {:id 3 :page 1}}}


        expected {:pages {1 {:id 1 :shapes [1 4]}}
                  :shapes {1 {:id 1 :page 1}
                           2 {:id 2 :page 1 :group 4}
                           3 {:id 3 :page 1 :group 4}
                           4 {:type :group :name "Group-1" :items [2 3] :id 4 :page 1}}
                  :workspace {:selected #{4}}}]
    (with-redefs [uxbox.util.uuid/random (constantly 4)]
      (let [result (impl/group-shapes initial [2 3] 1)]
        ;; (pprint expected)
        ;; (pprint result)
        (t/is (= result expected))))))

;; group group

(t/deftest group-shapes-3
  (let [initial {:pages {1 {:id 1 :shapes [1 2 3]}}
                 :shapes {1 {:id 1 :page 1}
                          2 {:id 2 :page 1}
                          3 {:id 3 :page 1 :type :group}}}
        expected {:pages {1 {:id 1 :shapes [1 4]}}
                  :shapes {1 {:id 1 :page 1}
                           2 {:id 2 :page 1 :group 4}
                           3 {:id 3 :page 1 :type :group :group 4}
                           4 {:type :group :name "Group-1" :items [2 3] :id 4 :page 1}}
                  :workspace {:selected #{4}}}]
    (with-redefs [uxbox.util.uuid/random (constantly 4)]
      (let [result (impl/group-shapes initial [2 3] 1)]
        ;; (pprint expected)
