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

atlp-rwanda / trojans-ec-fe / 0cb862e4-0fa2-47c7-95e9-d93125127b5b

pending completion
0cb862e4-0fa2-47c7-95e9-d93125127b5b

push

circleci

GitHub
feature(navbar/sidebar):Dashboard sidebar/navbar and main navbar [Finishes #185032608] (#33)

452 of 602 branches covered (75.08%)

Branch coverage included in aggregate %.

309 of 309 new or added lines in 56 files covered. (100.0%)

1056 of 1253 relevant lines covered (84.28%)

23.67 hits per line

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

60.87
/src/components/hooks/useSingleMainView.js
1
import React, { useState } from "react";
2
import { useDispatch, useSelector } from "react-redux";
3
import { addWishListThunk } from "../../redux/features/actions/wishlist";
4
import { getWishList } from "../../redux/features/slices/wishlist";
5
import { getWishListThunk } from "../../redux/features/actions/wishlist";
6
import {
7
  addToCartThunk,
8
  getCartThunk,
9
} from "../../redux/features/actions/cart";
10
import { getCart } from "../../redux/features/slices/cart";
11
import { toast } from "react-toastify";
12

13
export default function UseSingleMainView() {
14
  const dispatch = useDispatch();
16✔
15
  const { error } = useSelector(getCart);
16✔
16
  const addToCartHandler = (selectedProduct) => {
16✔
17
    dispatch(addToCartThunk(selectedProduct.id)).then(() =>
2✔
18
      dispatch(getCartThunk())
2✔
19
    );
20
    if (error.status === true) {
2!
21
      if (error.payload === 401) {
×
22
        toast.error("You need a buyer's account");
×
23
      }
24
    }
25
  };
26
  const { added, addedWish } = useSelector(getWishList);
16✔
27
  const wishLoading = useSelector(getWishList).loading;
16✔
28
  const wishError = useSelector(getWishList).error;
16✔
29
  const [modal, setModal] = useState(false);
16✔
30
  const addWishlist = async (selectedProduct) => {
16✔
31
    await dispatch(addWishListThunk(selectedProduct.id));
×
32
    await dispatch(getWishListThunk());
×
33
    setModal(true);
×
34
  };
35
  const toggleModal = () => {
16✔
36
    setModal(!modal);
×
37
  };
38
  return {
16✔
39
    addToCartHandler,
40
    addWishlist,
41
    toggleModal,
42
    wishLoading,
43
    added,
44
    addedWish,
45
    wishError,
46
    modal,
47
  };
48
}
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

© 2026 Coveralls, Inc