1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change 52
52
(testing " JS global console has tag Console"
53
53
(let [info (externs/info externs '[console])]
54
54
(is (= 'Console (:tag info)))))
55
- (testing " JS global crypto has tag webCrypto.Crypto"
55
+ (testing " JS global crypto has tag webCrypto.Crypto from:
56
+ @type {!webCrypto.Crypto|undefined}"
56
57
(let [info (externs/info externs '[crypto])]
57
- (is (= 'webCrypto.Crypto (:tag info)))))))
58
+ (is (= 'webCrypto.Crypto (:tag info)))))
59
+ (testing " Generic return type on crypto methods returns ClojureScript relevant
60
+ type info:"
61
+ (testing " @return {!Promise<!ArrayBuffer>}"
62
+ (let [info (externs/info externs '[webCrypto SubtleCrypto prototype encrypt])]
63
+ (is (= 'Promise (:ret-tag info)))))
64
+ (testing " @return {!Promise<!webCrypto.CryptoKey|!webCrypto.CryptoKeyPair>}"
65
+ (let [info (externs/info externs '[webCrypto SubtleCrypto prototype deriveKey])]
66
+ (is (= 'Promise (:ret-tag info)))))
67
+ (testing " @return {!Int8Array|!Uint8Array|!Uint8ClampedArray|!Int16Array|!Uint16Array|!Int32Array|!Uint32Array|!BigInt64Array|!BigUint64Array}"
68
+ (let [info (externs/info externs '[webCrypto SubtleCrypto prototype getRandomValues])]
69
+ (is (= 'any (:ret-tag info))))))))
58
70
59
71
(comment
60
72
73
+ (let [externs (::ana/externs @(env/default-compiler-env ))]
74
+ (externs/info externs '[webCrypto Crypto prototype getRandomValues]))
75
+
61
76
(externs/parse-externs
62
77
(externs/resource->source-file (io/resource " goog/object/object.js" )))
63
78
0 commit comments