Fakultas Ilmu Komputer UI

Commit 47a4ed35 authored by Shella Gabriella's avatar Shella Gabriella
Browse files

[GREEN] Menambahkan pesan & harga hampers pada transaksi

parent bea21f3c
Pipeline #82030 passed with stages
in 4 minutes and 26 seconds
import { cleanup, render } from "@testing-library/react";
import AuthContext from "../../utils/contex";
import React from "react";
import DetailTransaksi from "../../page/transaksi/DetailTransaksi";
import { waitFor } from "@testing-library/dom";
beforeEach(() => {
fetch.resetMocks();
});
afterEach(cleanup);
test("Test detail loaded transaksi", async () => {
fetch.mockResponseOnce(
JSON.stringify({
id: "8e9a8f94-cb5c-4b2d-b4f1-81ccfb9f1b0a",
transaction_number: "7NGVBN",
user: "45897cc5-968c-44cf-931d-e646b095fcaf",
user_username: "admin-staging",
program: "6d7462da-6a85-4e2b-9930-69567090a5d5",
program_code: "3MXZ9T",
user_full_name: "Hello",
user_phone_number: "012345",
program_name: "dummy 2",
hampers_messages: "",
hampers_price: "0.00",
created_at: "2020-04-28T21:34:15.565614+07:00",
updated_at: "2020-04-28T21:34:15.565651+07:00",
})
);
const { getByTestId } = render(
<AuthContext.Provider value={{ profile: { token: "tester" } }}>
<DetailTransaksi idTransaksi={"8e9a8f94-cb5c-4b2d-b4f1-81ccfb9f1b0a"} />
</AuthContext.Provider>
);
const wait = getByTestId("waiting-detail-transaksi");
expect(wait.textContent).toContain("Fetching data..");
await waitFor(() => getByTestId("page-detail-transaksi"));
const data = getByTestId("page-detail-transaksi");
expect(data.textContent).toContain("KELOLA TRANSAKSI");
});
......@@ -53,9 +53,7 @@ const DetailDonasiUang = ({ idDonasi }) => {
display: flex;
margin: 2rem 3rem 3rem 3rem;
flex-direction: column;
justify-content: space-around;
height: 75vh;
padding-top: 100px;
`}
>
{error && <ErrorDiv>Something error</ErrorDiv>}
......
......@@ -320,7 +320,9 @@ const DetailTransaksi = ({ idTransaksi }) => {
<TableRow>
<TableCell>Kode Produk</TableCell>
<TableCell>Nama Produk</TableCell>
<TableCell>Pesan (Hampers)</TableCell>
<TableCell>Kuantitas</TableCell>
<TableCell>Biaya Hampers</TableCell>
<TableCell>Harga Produk</TableCell>
<TableCell>Subtotal</TableCell>
</TableRow>
......@@ -332,7 +334,9 @@ const DetailTransaksi = ({ idTransaksi }) => {
<Link to={`/produk/${row.product}`}>{row.product_code}</Link>
</TableCell>
<TableCell>{row.product_name}</TableCell>
<TableCell>{row.hampers_messages}</TableCell>
<TableCell>{row.quantity}</TableCell>
<TableCell>{stringToCurrency(row.hampers_price)}</TableCell>
<TableCell>{stringToCurrency(row.product_price)}</TableCell>
<TableCell>
{stringToCurrency(
......@@ -342,7 +346,7 @@ const DetailTransaksi = ({ idTransaksi }) => {
</TableRow>
))}
<TableRow>
<TableCell rowSpan={3} colSpan={3} />
<TableCell rowSpan={3} colSpan={5} />
<TableCell align="left" colSpan={1}>
Donasi
</TableCell>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment