All files / components/Commons Profits.js

100% Statements 5/5
100% Branches 2/2
100% Functions 2/2
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35              4x   116x 3x           116x 116x                                  
import React from "react";
import { Card } from "react-bootstrap";
import ProfitsTable from "main/components/Commons/ProfitsTable";
 
import { timestampToDate } from "main/utils/dateUtils";
 
 
const Profits = ({ profits }) => {
    const profitsForTable =
        profits ?
        profits.map(profit => ({
            date: timestampToDate(profit.timestamp),
            ...profit
        })) : 
        // Stryker disable next-line ArrayDeclaration : no need to test what happens if [] is replaced with ["Stryker was here"]
        [];
        profitsForTable.reverse();
    return (
        <Card>
            <Card.Header as="h5">
                Profits
            </Card.Header>
            <Card.Body>
                {/* change 4am to admin-appointed time? And consider adding milk bottle as decoration */}
                <Card.Title>
                    You will earn profits from milking your cows everyday at 4am.
                </Card.Title>
                <ProfitsTable profits={profitsForTable} />
            </Card.Body>
        </Card>
    );
};
 
export default Profits;