             (t/is (= written (buf/size spec)))
             (let [[readed data'] (buf/read* buffer spec)]
               (t/is (= readed (buf/size spec)))
-              (t/is (= data data')))))))))
-
-;; #+clj
-;; (t/deftest spec-data-with-dynamic-types-single
-;;   (let [spec (buf/spec (buf/string*))
-;;         buffer (buf/allocate 20)]
-;;     (buf/write! buffer ["1234567890"] spec)
-;;     (let [[readed data] (buf/read* buffer spec)]
-;;       (t/is (= readed 14))
-;;       (t/is (= data ["1234567890"])))))
-
-;; #+clj
-;; (t/deftest spec-data-with-dynamic-types-combined
-;;   (let [spec (buf/spec (buf/string*) (buf/int64))
-;;         buffer (buf/allocate 40)]
-;;     (buf/write! buffer ["1234567890" 1000] spec)
-;;     (let [[readed data] (buf/read* buffer spec)]
-;;       (t/is (= readed 22))
-;;       (t/is (= data ["1234567890" 1000])))))
-
-;; #+clj
-;; (t/deftest spec-composition
-;;   (let [spec (buf/spec (buf/compose-type (buf/int32) (buf/int32))
-;;                        (buf/compose-type (buf/string 10) (buf/string 5)))
-;;         buffer (buf/allocate (buf/size spec))
-;;         data [[100 200] ["foo" "bar"]]]
-;;     (buf/write! buffer data spec)
-;;     (let [[readed data'] (buf/read* buffer spec)]
-;;       (t/is (= readed (buf/size spec)))
-;;       (t/is (= data' data)))))
+              (cond
+                (instance? js/Int8Array data')
+                (t/is (equals? data data'))
+
+                :else
+                (t/is (= data data'))))))))))
+
+(t/deftest spec-data-with-dynamic-types-single
+  (let [spec (buf/spec (buf/string*))
+        buffer (buf/allocate 20)]
+    (buf/write! buffer ["1234567890"] spec)
+    (let [[readed data] (buf/read* buffer spec)]
+      (t/is (= readed 14))
+      (t/is (= data ["1234567890"])))))
+
+(t/deftest spec-data-with-dynamic-types-combined
+  (let [spec (buf/spec (buf/string*) (buf/int32))
+        buffer (buf/allocate 40)]
+    (buf/write! buffer ["1234567890" 1000] spec)
+    (let [[readed data] (buf/read* buffer spec)]
+      (t/is (= readed 18))
+      (t/is (= data ["1234567890" 1000])))))
+
+(t/deftest spec-composition
+  (let [spec (buf/spec (buf/compose-type (buf/int32) (buf/int32))
+                       (buf/compose-type (buf/string 10) (buf/string 5)))
+        buffer (buf/allocate (buf/size spec))
+        data [[100 200] ["foo" "bar"]]]
+    (buf/write! buffer data spec)
+    (let [[readed data'] (buf/read* buffer spec)]
+      (t/is (= readed (buf/size spec)))
+      (t/is (= data' data)))))

    (t/is (= (buf/write! buffer data spec {:offset 3}) 4))
    (t/is (= (.getInt buffer 3) 500))))

#+clj
(t/deftest indexed-specs-write-wrong-buffer
  (let [spec (buf/spec (buf/int32))
        buffer (buf/allocate 2)
        data [1]]
    (t/is (thrown? java.lang.IndexOutOfBoundsException
                 (buf/write! buffer data spec) 12))))

#+clj
(t/deftest indexed-specs-read
  (let [spec (buf/spec (buf/int32) (buf/int64))
        buffer (buf/allocate 12)]
    (.putInt buffer 0 10)
    (.putLong buffer 4 100)
    (let [[readed data] (buf/read* buffer spec)]
      (t/is (= readed 12))
      (t/is (= data [10 100])))))

#+clj
(t/deftest indexed-specs-read-with-offset
  (let [spec (buf/spec (buf/int32))
        buffer (buf/allocate 12)]
    (.putInt buffer 8 1000)
    (let [[readed data] (buf/read* buffer spec {:offset 8})]
      (t/is (= readed 4))
      (t/is (= data [1000])))))

#+clj
(t/deftest spec-data-types
  (let [data [;; (buf/string 5) "12345"
              (buf/short)    100
              (buf/long)     1002
              (buf/integer)  1001


#+cljs
(t/deftest spec-data-types
  (let [data [(buf/string 5) "äåéëþ"
              (buf/short)    100
              (buf/integer)  1001
              (buf/bool)     false
              (buf/double)   (double 4.3)
              (buf/float)    (float 3.5)
              (buf/byte)     (byte 32)
              (buf/bytes 5)  (random-bytes 5)]]
    (doseq [[spec data] (partition 2 data)]
      (let [buffers [(buf/allocate (buf/size spec) {:impl :es6})]]
        (doseq [buffer buffers]
