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

decentraland / marketplace / 8249081468

12 Mar 2024 12:48PM UTC coverage: 66.114% (-0.02%) from 66.13%
8249081468

Pull #2181

github

LautaroPetaccio
fix: No unused vars & correct linting script in CI
Pull Request #2181: fix: Linting rules one (no-empty, no-yield, no-case-declarations and no-unused-vars)

2509 of 4914 branches covered (51.06%)

Branch coverage included in aggregate %.

3 of 5 new or added lines in 4 files covered. (60.0%)

1 existing line in 1 file now uncovered.

7428 of 10116 relevant lines covered (73.43%)

72.12 hits per line

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

86.96
/webapp/src/modules/collection/reducer.ts
1
import { Collection } from '@dcl/schemas'
2
import { loadingReducer, LoadingState } from 'decentraland-dapps/dist/modules/loading/reducer'
29✔
3
import {
4
  FetchCollectionsFailureAction,
5
  FetchCollectionsRequestAction,
6
  FetchCollectionsSuccessAction,
7
  FetchSingleCollectionFailureAction,
8
  FetchSingleCollectionRequestAction,
9
  FetchSingleCollectionSuccessAction,
10
  FETCH_COLLECTIONS_FAILURE,
11
  FETCH_COLLECTIONS_REQUEST,
12
  FETCH_COLLECTIONS_SUCCESS,
13
  FETCH_SINGLE_COLLECTION_FAILURE,
14
  FETCH_SINGLE_COLLECTION_REQUEST,
15
  FETCH_SINGLE_COLLECTION_SUCCESS
16
} from './actions'
29✔
17

18
export type CollectionState = {
19
  data: Record<string, Collection>
20
  count: number
21
  loading: LoadingState
22
  error: string | null
23
}
24

25
export const INITIAL_STATE: CollectionState = {
29✔
26
  data: {},
27
  count: 0,
28
  loading: [],
29
  error: null
30
}
31

32
type CollectionReducerAction =
33
  | FetchCollectionsRequestAction
34
  | FetchCollectionsSuccessAction
35
  | FetchCollectionsFailureAction
36
  | FetchSingleCollectionRequestAction
37
  | FetchSingleCollectionSuccessAction
38
  | FetchSingleCollectionFailureAction
39

40
export function collectionReducer(state = INITIAL_STATE, action: CollectionReducerAction): CollectionState {
240✔
41
  switch (action.type) {
1,963!
42
    case FETCH_COLLECTIONS_REQUEST:
43
    case FETCH_SINGLE_COLLECTION_REQUEST: {
44
      return {
10✔
45
        ...state,
46
        loading: loadingReducer(state.loading, action)
47
      }
48
    }
49
    case FETCH_COLLECTIONS_SUCCESS: {
50
      const { collections, count } = action.payload
1✔
51

52
      return {
1✔
53
        ...state,
54
        loading: loadingReducer(state.loading, action),
55
        error: null,
56
        data: collections.reduce(
57
          (acc, collection) => {
58
            acc[collection.urn] = collection
1✔
59
            return acc
1✔
60
          },
61
          {} as CollectionState['data']
62
        ),
63
        count
64
      }
65
    }
66
    case FETCH_SINGLE_COLLECTION_SUCCESS: {
UNCOV
67
      const { collection } = action.payload
×
68

69
      return {
×
70
        ...state,
71
        loading: loadingReducer(state.loading, action),
72
        error: null,
73
        data: { ...state.data, [collection.urn]: collection }
74
      }
75
    }
76
    case FETCH_COLLECTIONS_FAILURE:
77
    case FETCH_SINGLE_COLLECTION_FAILURE: {
78
      const { error } = action.payload
1✔
79

80
      return {
1✔
81
        ...state,
82
        loading: loadingReducer(state.loading, action),
83
        error
84
      }
85
    }
86
    default:
87
      return state
1,951✔
88
  }
89
}
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