Upgrade clj-kondo and configure new linters (#17543)

- Upgrade clj-kondo to latest version to take advantage of new linters. From
  version 2023.04.14
  https://github.com/clj-kondo/clj-kondo/blob/master/CHANGELOG.md#20230414 to
  2023.09.07
  https://github.com/clj-kondo/clj-kondo/blob/master/CHANGELOG.md#20230907
- Use new linter ":unused-alias" and set at WARN level for the moment, because
  otherwise the PR would increase a bit too much, but it did catch many unused
  "require" aliases. Added in version 2023.09.07
  https://github.com/clj-kondo/clj-kondo/blob/master/CHANGELOG.md#20230907
- Use new linter ":case-symbol-test" and fix the reported errors, added in
  version 2023.07.13
  https://github.com/clj-kondo/clj-kondo/blob/master/CHANGELOG.md#20230713
- Use new linters ":equals-true", ":plus-one", and ":minus-one" and fix reported
  errors, added in version 2023.05.18
  https://github.com/clj-kondo/clj-kondo/blob/master/CHANGELOG.md#20230518
- Raise level from WARN to ERROR for linter "uninitialized-var".
- Explicitly add ":case-duplicate-test" to clj-kondo config, renamed in version
  2023.07.13
  https://github.com/clj-kondo/clj-kondo/blob/master/CHANGELOG.md#20230713
- Explicitly add ":case-quoted-test" to clj-kondo config, renamed in version
  2023.07.13
  https://github.com/clj-kondo/clj-kondo/blob/master/CHANGELOG.md#20230713
- Explicitly add ":deprecated-namespace" to clj-kondo config, added in version
  2023.07.13
  https://github.com/clj-kondo/clj-kondo/blob/master/CHANGELOG.md#20230713

Fixes https://github.com/status-im/status-mobile/issues/17287
This commit is contained in:
Icaro Motta 2023-10-05 18:50:57 +00:00 committed by GitHub
parent d80fb0b3de
commit b73ac6b107
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 150 additions and 116 deletions

View File

@ -9,23 +9,29 @@
status-im.utils.styles/defn clojure.core/defn
test-helpers.unit/deftest-sub clojure.core/defn
taoensso.tufte/defnp clojure.core/defn}
:linters {:clj-kondo-config {:level :error}
:linters {:case-duplicate-test {:level :error}
:case-quoted-test {:level :error}
:case-symbol-test {:level :error}
:clj-kondo-config {:level :error}
:cond-else {:level :error}
:consistent-alias {:level :error
:aliases {clojure.string string
clojure.set set
clojure.walk walk
taoensso.timbre log}}
:deprecated-namespace {:level :warning}
:docstring-blank {:level :error}
:equals-true {:level :error}
:inline-def {:level :error}
:invalid-arity {:skip-args [status-im.utils.fx/defn utils.re-frame/defn]}
:loop-without-recur {:level :error}
:minus-one {:level :error}
:misplaced-docstring {:level :error}
:missing-body-in-when {:level :error}
:missing-clause-in-try {:level :error}
:missing-else-branch {:level :error}
:not-empty? {:level :error}
:quoted-case-test-constant {:level :error}
:plus-one {:level :error}
:redundant-do {:level :error}
:redundant-let {:level :error}
:refer-all {:level :error}
@ -48,6 +54,8 @@
number
status-im.test-helpers/restore-app-db]}
:unresolved-var {:level :error}
:uninitialized-var {:level :error}
:unused-alias {:level :warning}
:unused-binding {:level :error}
:unused-import {:level :error}
:unused-namespace {:level :error}

View File

@ -38,6 +38,19 @@ in {
};
});
# Clojure's linter receives frequent upgrades, and we want to take advantage
# of the latest available rules.
clj-kondo = super.clj-kondo.override rec {
buildGraalvmNativeImage = args: super.buildGraalvmNativeImage (args // rec {
inherit (args) pname;
version = "2023.09.07";
src = super.fetchurl {
url = "https://github.com/clj-kondo/${pname}/releases/download/v${version}/${pname}-${version}-standalone.jar";
sha256 = "sha256-F7ePdITYKkGB6nsR3EFJ7zLDCUoT0g3i+AAjXzBd624=";
};
});
};
# Checks fail on darwin.
git-lfs = super.git-lfs.overrideAttrs (old: {
doCheck = false;

View File

@ -5,8 +5,8 @@
[{:keys [pressed? blur? theme]}]
(cond
(and pressed? blur?) (colors/theme-colors colors/neutral-80-opa-20 colors/white-opa-20 theme)
(= pressed? true) (colors/theme-colors colors/neutral-40 colors/neutral-60 theme)
(= blur? true) (colors/theme-colors colors/neutral-80-opa-10 colors/white-opa-10 theme)
pressed? (colors/theme-colors colors/neutral-40 colors/neutral-60 theme)
blur? (colors/theme-colors colors/neutral-80-opa-10 colors/white-opa-10 theme)
:else (colors/theme-colors colors/neutral-30 colors/neutral-70 theme)))
(defn get-label-color

View File

@ -3,7 +3,7 @@
(defn get-border-color
[{:keys [pressed? theme]}]
(if (= pressed? true)
(if pressed?
(colors/theme-colors colors/neutral-40 colors/neutral-60 theme)
(colors/theme-colors colors/neutral-30 colors/neutral-70 theme)))

View File

@ -6,7 +6,7 @@
(defn generate-years
[current-year]
(let [current-year current-year]
(reverse (vec (range (- current-year 100) (+ current-year 1))))))
(reverse (vec (range (- current-year 100) (inc current-year))))))
(defn current-year
[]

View File

@ -55,7 +55,7 @@
[rn/view {:accessibility-label :line-chart}
[charts/line-chart
{:height 96
:width (+ width 1)
:width (inc width)
:max-value max-value
:min-value 0
:adjust-to-width true

View File

@ -8,7 +8,7 @@
(defn reorder-item
[item type {:keys [blur? drag]}]
(case type
(condp = type
types/item [item/view item blur? drag]
types/placeholder [placeholder/view item]
types/skeleton [skeleton/view]

View File

@ -25,7 +25,7 @@
(defn- rpc->type
[{:keys [type name] :as chat}]
(case type
(condp = type
notification-types/reply
(assoc chat
:chat-name name

View File

@ -199,10 +199,11 @@
(defn contact-request-status-label
[state]
[rn/view {:style (style/contact-request-status-label state)}
(case state
(condp = state
constants/contact-request-message-state-pending [contact-request-status-pending]
constants/contact-request-message-state-accepted [contact-request-status-accepted]
constants/contact-request-message-state-declined [contact-request-status-declined])])
constants/contact-request-message-state-declined [contact-request-status-declined]
nil)])
;;;; SYSTEM

View File

@ -389,10 +389,11 @@
:background-color (when (= :retry state)
colors/blue-light)
:border-width 1
:border-color (case state
:border-color (condp = state
constants/contact-request-message-state-accepted colors/green-transparent-10
constants/contact-request-message-state-declined colors/red-light
constants/contact-request-message-state-pending colors/gray-lighter)
constants/contact-request-message-state-pending colors/gray-lighter
nil)
:padding-vertical 10
:padding-horizontal 16})

View File

@ -34,7 +34,7 @@
:pending (transaction-icon :main-icons/arrow-right
colors/black-transparent
colors/gray)
(throw (str "Unknown transaction type: " k))))
(throw (js/Error. (str "Unknown transaction type: " k)))))
(defn render-transaction
[{:keys [label contact address contact-accessibility-label

View File

@ -6,18 +6,18 @@
(deftest test-too-precise-amount?
(testing "try both decimal and scientific or hex format"
(is (= false (#'status-im.wallet.db/too-precise-amount? "100" 2)))
(is (= false (#'status-im.wallet.db/too-precise-amount? "100" 0)))
(is (= true (#'status-im.wallet.db/too-precise-amount? "100.1" 0)))
(is (= false (#'status-im.wallet.db/too-precise-amount? "100.23" 2)))
(is (= true (#'status-im.wallet.db/too-precise-amount? "100.233" 2)))
(is (= true (#'status-im.wallet.db/too-precise-amount? "100.0000000000000000001" 18)))
(is (= false (#'status-im.wallet.db/too-precise-amount? "100.000000000000000001" 18)))
(is (= false (#'status-im.wallet.db/too-precise-amount? "1e-18" 18)))
(is (= true (#'status-im.wallet.db/too-precise-amount? "1e-19" 18)))
(is (= true (#'status-im.wallet.db/too-precise-amount? "0xa.a" 2))) ;; 0xa.a is 10.625
(is (= false (#'status-im.wallet.db/too-precise-amount? "0xa.a" 3)))
(is (= false (#'status-im.wallet.db/too-precise-amount? "1000" 3)))))
(is (false? (#'status-im.wallet.db/too-precise-amount? "100" 2)))
(is (false? (#'status-im.wallet.db/too-precise-amount? "100" 0)))
(is (true? (#'status-im.wallet.db/too-precise-amount? "100.1" 0)))
(is (false? (#'status-im.wallet.db/too-precise-amount? "100.23" 2)))
(is (true? (#'status-im.wallet.db/too-precise-amount? "100.233" 2)))
(is (true? (#'status-im.wallet.db/too-precise-amount? "100.0000000000000000001" 18)))
(is (false? (#'status-im.wallet.db/too-precise-amount? "100.000000000000000001" 18)))
(is (false? (#'status-im.wallet.db/too-precise-amount? "1e-18" 18)))
(is (true? (#'status-im.wallet.db/too-precise-amount? "1e-19" 18)))
(is (true? (#'status-im.wallet.db/too-precise-amount? "0xa.a" 2))) ;; 0xa.a is 10.625
(is (false? (#'status-im.wallet.db/too-precise-amount? "0xa.a" 3)))
(is (false? (#'status-im.wallet.db/too-precise-amount? "1000" 3)))))
(defn- equal-results?
[a b]

View File

@ -236,17 +236,17 @@
{2 {0 image-size
1 image-size}
3 {0 [(* image-size 2) (* image-size 1.25)]
1 [(- image-size 0.5) (- (* image-size 0.75) 1)]
2 [(- image-size 0.5) (- (* image-size 0.75) 1)]}
1 [(- image-size 0.5) (dec (* image-size 0.75))]
2 [(- image-size 0.5) (dec (* image-size 0.75))]}
4 {0 image-size
1 image-size
2 image-size
3 image-size}
5 {0 image-size
1 image-size
2 (- (* image-size 0.67) 1)
3 (- (* image-size 0.67) 1)
4 (- (* image-size 0.67) 1)}
2 (dec (* image-size 0.67))
3 (dec (* image-size 0.67))
4 (dec (* image-size 0.67))}
:default {0 image-size
1 image-size
2 (- (* image-size 0.5) 0.5)

View File

@ -122,7 +122,7 @@
:style {:color (colors/theme-colors colors/neutral-50 colors/neutral-40)
:margin-top 2}}
(str " "
(case (or content-type contentType)
(condp = (or content-type contentType)
constant/content-type-image (if (pos? album-images-count)
(i18n/label :t/album-images-count
{:album-images-count album-images-count})

View File

@ -60,8 +60,8 @@
:other-person
:dont-show))
preview-text
(case content-type
constants/content-type-text
(cond
(= content-type constants/content-type-text)
(if reply?
(case author
:you (str (i18n/label :t/you-replied) ": " content-text)
@ -74,33 +74,34 @@
:dont-show content-text
content-text))
constants/content-type-emoji
(= content-type constants/content-type-emoji)
(case author
:you (str (i18n/label :t/You) ": " content-text)
:other-person (str primary-name ": " content-text)
:dont-show content-text
content-text)
constants/content-type-system-text
(= content-type constants/content-type-system-text)
(case author
:you (i18n/label :t/you-pinned-a-message)
:other-person (i18n/label :t/user-pinned-a-message {:user primary-name})
:dont-show (i18n/label :t/Pinned-a-message)
(i18n/label :t/Pinned-a-message))
(constants/content-type-contact-request
constants/content-type-system-message-mutual-event-removed
constants/content-type-system-message-mutual-event-accepted)
(#{constants/content-type-contact-request
constants/content-type-system-message-mutual-event-removed
constants/content-type-system-message-mutual-event-accepted}
content-type)
(i18n/label :t/contact-request)
constants/content-type-sticker
(= content-type constants/content-type-sticker)
(case author
:you (i18n/label :t/you-sent-a-sticker)
:other-person (i18n/label :t/user-sent-a-sticker {:user primary-name})
:dont-show (i18n/label :t/sent-a-sticker)
(i18n/label :t/sent-a-sticker))
constants/content-type-image
(= content-type constants/content-type-image)
(let [sent-photos (if album-images-count
(case author
:you (i18n/label :t/you-sent-n-photos
@ -119,31 +120,31 @@
(str sent-photos ": " content-text)
sent-photos))
constants/content-type-audio
(= content-type constants/content-type-audio)
(case author
:you (i18n/label :t/you-sent-audio-message)
:other-person (i18n/label :t/user-sent-audio-message {:user primary-name})
:dont-show (i18n/label :t/sent-audio-message)
(i18n/label :t/sent-audio-message))
constants/content-type-gif
(= content-type constants/content-type-gif)
(case author
:you (i18n/label :t/you-sent-a-gif)
:other-person (i18n/label :t/user-sent-audio-message {:user primary-name})
:dont-show (i18n/label :t/sent-a-gif)
(i18n/label :t/sent-a-gif))
constants/content-type-community
(= content-type constants/content-type-community)
(case author
:you (i18n/label :t/you-shared-a-community)
:other-person (i18n/label :t/user-shared-a-community {:user primary-name})
:dont-show (i18n/label :t/shared-a-community)
(i18n/label :t/shared-a-community))
:else
"")]
(subs preview-text 0 (min (count preview-text) max-subheader-length))))
(defn last-message-preview
"Render the preview of a last message to a maximum of max-subheader-length characters"
[group-chat {:keys [deleted? outgoing from deleted-for-me?] :as message}]

View File

@ -110,9 +110,8 @@
[index {:keys [opacity-value border-value full-screen-scale transparent? props]} portrait?]
(let [{:keys [small-list-ref timers text-sheet-lock?]} props
opacity (reanimated/get-shared-value opacity-value)
scale-value (+ 1
(/ constants/margin
(:width (rn/get-window))))]
scale-value (inc (/ constants/margin
(:width (rn/get-window))))]
(if (= opacity 1)
(do
(js/clearTimeout (:show-0 @timers))

View File

@ -26,7 +26,8 @@
:landscape
:portrait)
images-count (count (:album message))
;; album images are always square, except when we have 3 images, then they must be rectangular
;; album images are always square, except when we have 3 images, then they must be
;; rectangular
;; (portrait or landscape)
portrait? (and (= images-count rectangular-style-count) (= album-style :portrait))]
(if (and albumize? (> images-count 1))
@ -61,7 +62,7 @@
(< index constants/max-album-photos))
:shared-element)}]
(when (and (> images-count constants/max-album-photos)
(= index (- constants/max-album-photos 1)))
(= index (dec constants/max-album-photos)))
[rn/view
{:style style/overlay}
[quo/text

View File

@ -173,8 +173,7 @@
:max-height (when-not show-reactions?
(* 0.4 height))}}
[author message-data show-reactions? show-user-info?]
(case content-type
(condp = content-type
constants/content-type-text
[content.text/text-content message-data context]

View File

@ -101,7 +101,7 @@
(defn get-access-type
[access]
(case access
(condp = access
constants/community-no-membership-access :open
constants/community-invitation-only-access :invite-only
constants/community-on-request-access :request-access
@ -339,8 +339,8 @@
{:on-category-layout (partial add-category-height categories-heights)
:collapsed? collapsed?
:on-first-channel-height-changed
;; Here we set the height of the component and we filter out the categories, as some might
;; have been removed.
;; Here we set the height of the component and we filter out the categories, as some
;; might have been removed.
(fn [height categories]
(swap! categories-heights select-keys categories)
(reset! first-channel-height height))}]]))))

View File

@ -16,7 +16,9 @@
(def ^:const emoji-row-separator-height 16)
(def ^:const emoji-item-margin-right
(/ (- (:width (rn/get-window)) (* emoji-row-padding-horizontal 2) (* emoji-size emojis-per-row))
(- emojis-per-row 1)))
(/ (- (:width (rn/get-window))
(* emoji-row-padding-horizontal 2)
(* emoji-size emojis-per-row))
(dec emojis-per-row)))
(def ^:const item-height (+ emoji-size emoji-row-separator-height))

View File

@ -61,7 +61,7 @@
(if (>= current-progress drag-limit)
drag-limit
(-> (quot current-progress progress-threshold)
(+ 1)
inc
(* progress-threshold)))))
(defn get-previous-progress
@ -70,7 +70,7 @@
(if (< current-progress progress-threshold)
0
(-> (quot current-progress progress-threshold)
(- 1)
dec
(* progress-threshold)))))
(defn use-initialize-animation

View File

@ -156,7 +156,7 @@
{:data (sort-by :timestamp > profiles)
:key-fn :key-uid
:content-container-style {:padding-bottom 20}
:render-data {:last-index (- (count profiles) 1)
:render-data {:last-index (dec (count profiles))
:set-hide-profiles set-hide-profiles}
:render-fn profile-card}]]))

View File

@ -99,7 +99,7 @@
(defn get-mock-content
[data]
(case (:content-type data)
(condp = (:content-type data)
constants/content-type-text
(:last-message data)
@ -135,16 +135,19 @@
:community-channel {:emoji "🍑" :channel-name "# random"}
:community-info {:type :kicked}
:data (get-mock-content data)}}
(case type
shell.constants/one-to-one-chat-card
(cond
(= type shell.constants/one-to-one-chat-card)
{:avatar-params {:full-name (:title data)}}
shell.constants/private-group-chat-card
(= type shell.constants/private-group-chat-card)
{}
(shell.constants/community-card
shell.constants/community-channel-card)
(#{shell.constants/community-card
shell.constants/community-channel-card}
type)
{:avatar-params community-avatar}
:else
{})))
(defn preview-switcher-cards

View File

@ -74,7 +74,7 @@
:blur? true
:community-logo community-image
:community-name community-name}]]
:items (case membership-status
:items (condp = membership-status
constants/activity-center-membership-status-accepted
[{:type :status
:subtype :positive

View File

@ -83,7 +83,7 @@
:context [(i18n/label :t/contact-request-outgoing)
[common/user-avatar-tag chat-id]]
:message {:body (get-in message [:content :text])}
:items (case contact-request-state
:items (condp = contact-request-state
constants/contact-request-message-state-pending
[{:type :status
:subtype :pending
@ -115,7 +115,7 @@
(i18n/label :t/contact-request-sent)]
:message {:body (get-in message [:content :text])}
:items
(case (:contact-request-state message)
(condp = (:contact-request-state message)
constants/contact-request-message-state-accepted
[{:type :status
:subtype :positive
@ -143,6 +143,7 @@
:label (i18n/label :t/accept)
:accessibility-label :accept-contact-request
:on-press #(rf/dispatch [:activity-center.contact-requests/accept id])}]
nil)}]))
(defn view

View File

@ -15,9 +15,10 @@
;; NOTE: Replies support text, image and stickers only.
(defn- get-message-content
[{:keys [content-type] :as message} album-messages media-server-port]
(case content-type
constants/content-type-text [quo/text {:style style/tag-text}
(get-in message [:content :text])]
(condp = content-type
constants/content-type-text
[quo/text {:style style/tag-text}
(get-in message [:content :text])]
constants/content-type-image
(let [images (or album-messages message)
@ -31,7 +32,8 @@
{:photos image-local-urls
:message-text (get-in message [:content :text])}])
constants/content-type-sticker [old-message/sticker message]
constants/content-type-sticker
[old-message/sticker message]
constants/content-type-system-pinned-message
[not-implemented/not-implemented
@ -40,9 +42,10 @@
;; NOTE: The following type (system-text) doesn't have a design yet.
;; https://github.com/status-im/status-mobile/issues/14915
constants/content-type-system-text [not-implemented/not-implemented
[quo/text {:style style/tag-text}
(get-in message [:content :text])]]
constants/content-type-system-text
[not-implemented/not-implemented
[quo/text {:style style/tag-text}
(get-in message [:content :text])]]
nil))

View File

@ -50,13 +50,10 @@
[admin/view props]
(some types/membership [type])
(case type
(condp = type
types/private-group-chat [membership/view props]
types/community-request [community-request/view props]
types/community-kicked [community-kicked/view props]
nil)
:else

View File

@ -35,7 +35,7 @@
community-info community-channel]
{:keys [text parsed-text source]} :data}]
[rn/view {:style (style/content-container new-notifications?)}
(case type
(condp = type
shell.constants/community-card
(case (:type community-info)
:pending [quo/status-tag
@ -52,7 +52,7 @@
shell.constants/community-channel-card
[channel-card (assoc community-channel :customization-color color-50)]
(case content-type
(condp = content-type
constants/content-type-text
[quo/text
{:size :paragraph-2
@ -90,7 +90,7 @@
:community-logo (:avatar data)
:community-name (:community-name data)}]
(constants/content-type-link) ;; Components not available
constants/content-type-link ;; Components not available
;; Code snippet content type is not supported yet
[:<>]
@ -114,21 +114,22 @@
(defn avatar
[avatar-params type customization-color]
(case type
shell.constants/one-to-one-chat-card
(cond
(= type shell.constants/one-to-one-chat-card)
[quo/user-avatar
(merge {:size :medium
:status-indicator? false}
avatar-params)]
shell.constants/private-group-chat-card
(= type shell.constants/private-group-chat-card)
[quo/group-avatar
{:customization-color customization-color
:size :size-48
:override-theme :dark}]
(shell.constants/community-card
shell.constants/community-channel-card)
(#{shell.constants/community-card
shell.constants/community-channel-card}
type)
(cond
(:source avatar-params)
[fast-image/fast-image
@ -144,18 +145,19 @@
:style {:color colors/white-opa-70}}
(string/upper-case (first (:name avatar-params)))]])
:else
nil))
(defn subtitle
[type {:keys [content-type data]}]
(case type
(condp = type
shell.constants/community-card
(i18n/label :t/community)
shell.constants/community-channel-card
(i18n/label :t/community-channel)
(case content-type
(condp = content-type
constants/content-type-text
(i18n/label :t/message)
@ -298,29 +300,32 @@
(defn card
[{:keys [type] :as data}]
(case type
shell.constants/empty-card ;; Placeholder
(cond
(= type shell.constants/empty-card) ; Placeholder
[empty-card]
(shell.constants/one-to-one-chat-card ;; Screens Card
shell.constants/private-group-chat-card
shell.constants/community-card
shell.constants/community-channel-card)
;; Screens Card
(#{shell.constants/one-to-one-chat-card
shell.constants/private-group-chat-card
shell.constants/community-card
shell.constants/community-channel-card}
type)
[screens-card data]
shell.constants/browser-card ;; Browser Card
(= type shell.constants/browser-card) ; Browser Card
[browser-card data]
shell.constants/wallet-card ;; Wallet Card
(= type shell.constants/wallet-card) ; Wallet Card
[wallet-card data]
shell.constants/wallet-collectible ;; Wallet Card
(= type shell.constants/wallet-collectible) ; Wallet Card
[wallet-collectible data]
shell.constants/wallet-graph ;; Wallet Card
(= type shell.constants/wallet-graph) ; Wallet Card
[wallet-graph data]
shell.constants/communities-discover ;; Home Card
(= type shell.constants/communities-discover) ; Home Card
[communities-discover data]
:else
nil))

View File

@ -57,7 +57,7 @@
(case view-id
:chat
(let [chat (get-in db [:chats id])]
(case (:chat-type chat)
(condp = (:chat-type chat)
constants/one-to-one-chat-type
{:card-id id
:switcher-card {:type shell.constants/one-to-one-chat-card

View File

@ -26,13 +26,13 @@
(def mock-current-time-epoch 1655731506000)
(deftest is-24-hour-locale-en-test
(is (= (#'utils.datetime/is-24-hour-locsym (i18n-goog/locale-symbols "en")) false)))
(is (false? (#'utils.datetime/is-24-hour-locsym (i18n-goog/locale-symbols "en")))))
(deftest is-24-hour-locale-it-test
(is (= (#'utils.datetime/is-24-hour-locsym (i18n-goog/locale-symbols "it")) true)))
(is (true? (#'utils.datetime/is-24-hour-locsym (i18n-goog/locale-symbols "it")))))
(deftest is-24-hour-locale-nb-test
(is (= (#'utils.datetime/is-24-hour-locsym (i18n-goog/locale-symbols "nb-NO")) true)))
(is (true? (#'utils.datetime/is-24-hour-locsym (i18n-goog/locale-symbols "nb-NO")))))
(deftest to-short-str-today-test
(with-redefs [t/*ms-fn* (constantly epoch-plus-3d)

View File

@ -3,14 +3,14 @@
[utils.ethereum.eip.eip55 :as eip55]))
(deftest valid-address-checksum?
(is (= true (eip55/valid-address-checksum? "0x52908400098527886E0F7030069857D2E4169EE7")))
(is (= true (eip55/valid-address-checksum? "0x8617E340B3D01FA5F11F306F4090FD50E238070D")))
(is (= true (eip55/valid-address-checksum? "0xde709f2102306220921060314715629080e2fb77")))
(is (= true (eip55/valid-address-checksum? "0x27b1fdb04752bbc536007a920d24acb045561c26")))
(is (= true (eip55/valid-address-checksum? "0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed")))
(is (= true (eip55/valid-address-checksum? "0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359")))
(is (= true (eip55/valid-address-checksum? "0xdbF03B407c01E7cD3CBea99509d93f8DDDC8C6FB")))
(is (= true (eip55/valid-address-checksum? "0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb")))
(is (= false (eip55/valid-address-checksum? "0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9adB")))
(is (= false (eip55/valid-address-checksum? "0x8617e340b3d01fa5f11f306f4090fd50e238070d")))
(is (= false (eip55/valid-address-checksum? "0xDE709F2102306220921060314715629080E2fB77"))))
(is (true? (eip55/valid-address-checksum? "0x52908400098527886E0F7030069857D2E4169EE7")))
(is (true? (eip55/valid-address-checksum? "0x8617E340B3D01FA5F11F306F4090FD50E238070D")))
(is (true? (eip55/valid-address-checksum? "0xde709f2102306220921060314715629080e2fb77")))
(is (true? (eip55/valid-address-checksum? "0x27b1fdb04752bbc536007a920d24acb045561c26")))
(is (true? (eip55/valid-address-checksum? "0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed")))
(is (true? (eip55/valid-address-checksum? "0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359")))
(is (true? (eip55/valid-address-checksum? "0xdbF03B407c01E7cD3CBea99509d93f8DDDC8C6FB")))
(is (true? (eip55/valid-address-checksum? "0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb")))
(is (false? (eip55/valid-address-checksum? "0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9adB")))
(is (false? (eip55/valid-address-checksum? "0x8617e340b3d01fa5f11f306f4090fd50e238070d")))
(is (false? (eip55/valid-address-checksum? "0xDE709F2102306220921060314715629080E2fB77"))))