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

decentraland / marketplace / 9604252205

20 Jun 2024 08:55PM UTC coverage: 66.593% (+0.09%) from 66.499%
9604252205

push

github

web-flow
fix location error (#2263)

2606 of 5072 branches covered (51.38%)

Branch coverage included in aggregate %.

30 of 40 new or added lines in 7 files covered. (75.0%)

1 existing line in 1 file now uncovered.

7606 of 10263 relevant lines covered (74.11%)

77.63 hits per line

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

83.87
/webapp/src/modules/collection/selectors.ts
1
import { createMatchSelector } from 'connected-react-router'
4✔
2
import { AnyAction } from 'redux'
3
import { createSelector } from 'reselect'
4✔
4
import { Collection } from '@dcl/schemas'
5
import { RootState } from '../reducer'
6
import { locations } from '../routing/locations'
4✔
7
import {
8
  FETCH_COLLECTIONS_REQUEST,
9
  FETCH_SINGLE_COLLECTION_REQUEST,
10
  FetchCollectionsRequestAction,
11
  FetchSingleCollectionRequestAction
12
} from './actions'
4✔
13

14
const isFetchSingleCollectionRequestAction = (action: AnyAction): action is FetchSingleCollectionRequestAction =>
4✔
15
  action.type === FETCH_SINGLE_COLLECTION_REQUEST
22✔
16
const isFetchCollectionsRequestAction = (action: AnyAction): action is FetchCollectionsRequestAction =>
4✔
17
  action.type === FETCH_COLLECTIONS_REQUEST
4✔
18

19
export const getState = (state: RootState) => state.collection
108✔
20
export const getCollectionsByUrn = (state: RootState) => getState(state).data
26✔
21
export const getCount = (state: RootState) => getState(state).count
4✔
22
export const getError = (state: RootState) => getState(state).error
26✔
23
export const getLoading = (state: RootState) => getState(state).loading
56✔
24

25
export const isFetchingCollection = (state: RootState, contractAddress: string) =>
30✔
26
  getLoading(state).find(
30✔
27
    action =>
28
      (isFetchSingleCollectionRequestAction(action) && action.payload.contractAddress === contractAddress) ||
22✔
29
      (isFetchCollectionsRequestAction(action) && action.payload.filters?.contractAddress === contractAddress)
30
  ) !== undefined
31

32
export const getCollections = createSelector<RootState, ReturnType<typeof getCollectionsByUrn>, Collection[]>(
4✔
33
  getCollectionsByUrn,
34
  collectionsByUrn => Object.values(collectionsByUrn)
2✔
35
)
36

37
export const getCollectionsByAddress = createSelector<RootState, ReturnType<typeof getCollections>, Record<string, Collection>>(
26✔
38
  getCollections,
39
  collections =>
40
    Object.values(collections).reduce(
2✔
41
      (acc, collection) => {
42
        acc[collection.contractAddress] = collection
×
43
        return acc
×
44
      },
45
      {} as Record<string, Collection>
46
    )
47
)
48

49
const CollectionDetailMatchSelector = createMatchSelector<RootState, { contractAddress: string }>(locations.collection(':contractAddress'))
4✔
50

51
export const getContractAddress = createSelector<RootState, ReturnType<typeof CollectionDetailMatchSelector>, string | null>(
4✔
52
  CollectionDetailMatchSelector,
NEW
53
  match => match?.params.contractAddress.toLowerCase() || null
×
54
)
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