• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

decentraland / marketplace / 9999902307

18 Jul 2024 11:10PM UTC coverage: 66.468% (-0.2%) from 66.682%
9999902307

Pull #2268

github

meelrossi
fix isBid trade calculation
Pull Request #2268: feat: add accept trade flow

2635 of 5152 branches covered (51.15%)

Branch coverage included in aggregate %.

71 of 128 new or added lines in 11 files covered. (55.47%)

3 existing lines in 2 files now uncovered.

7714 of 10418 relevant lines covered (74.04%)

77.68 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

32.0
/webapp/src/components/Bid/WarningMessage/WarningMessage.tsx
1
import React, { useEffect, useState } from 'react'
1✔
2
import { t } from 'decentraland-dapps/dist/modules/translation/utils'
1✔
3
import { isNFT } from '../../../modules/asset/utils'
1✔
4
import { isInsufficientMANA, checkFingerprint } from '../../../modules/bid/utils'
1✔
5
import { useFingerprint } from '../../../modules/nft/hooks'
1✔
6
import { Props } from './WarningMessage.types'
7
import './WarningMessage.css'
1✔
8

9
const WarningMessage = (props: Props) => {
1✔
NEW
10
  const { asset, bid } = props
×
11

NEW
12
  const [fingerprint] = useFingerprint(asset && isNFT(asset) ? asset : null)
×
13
  const [hasInsufficientMANA, setHasInsufficientMANA] = useState(false)
×
14

15
  useEffect(() => {
×
16
    isInsufficientMANA(bid)
×
17
      .then(setHasInsufficientMANA)
18
      .catch(error => console.error(`Could not get the MANA from bidder ${bid.bidder}`, error))
×
19
  }, [bid])
20

21
  const isValidFingerprint = checkFingerprint(bid, fingerprint)
×
22

23
  if (hasInsufficientMANA) {
×
24
    return <div className="WarningMessage">{t('bid.not_enough_mana_on_bid_placed')}</div>
25
  } else if (!isValidFingerprint) {
×
26
    return <div className="WarningMessage">{t('bid.invalid_fingerprint_on_bid_placed')}</div>
27
  }
28

29
  return null
×
30
}
31

32
export default React.memo(WarningMessage)
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc