Add Transactions view with detailed tx log
This commit is contained in:
@@ -166,6 +166,60 @@ const incomeStatementReport = {
|
||||
meta: { hledger_version: "1.52.1" },
|
||||
};
|
||||
|
||||
const transactionsReport = {
|
||||
report_type: "transactions",
|
||||
period: { begin: null, end: null },
|
||||
transactions: [
|
||||
{
|
||||
date: "2024-01-01",
|
||||
date2: null,
|
||||
description: "Opening balances",
|
||||
code: "",
|
||||
postings: [
|
||||
{
|
||||
account: "assets:bank:checking",
|
||||
amounts: [
|
||||
{ commodity: "EUR", quantity: "1000.0", display: "1000.00 EUR" },
|
||||
],
|
||||
},
|
||||
{
|
||||
account: "equity:alice",
|
||||
amounts: [
|
||||
{ commodity: "EUR", quantity: "-600.0", display: "-600.00 EUR" },
|
||||
],
|
||||
},
|
||||
{
|
||||
account: "equity:bob",
|
||||
amounts: [
|
||||
{ commodity: "EUR", quantity: "-400.0", display: "-400.00 EUR" },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
date: "2024-02-10",
|
||||
date2: null,
|
||||
description: "Hosting",
|
||||
code: "",
|
||||
postings: [
|
||||
{
|
||||
account: "expenses:hosting:server",
|
||||
amounts: [
|
||||
{ commodity: "EUR", quantity: "20.5", display: "20.50 EUR" },
|
||||
],
|
||||
},
|
||||
{
|
||||
account: "assets:bank:checking",
|
||||
amounts: [
|
||||
{ commodity: "EUR", quantity: "-20.5", display: "-20.50 EUR" },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
meta: { hledger_version: "1.52.1" },
|
||||
};
|
||||
|
||||
acceptance("Hledger plugin", function (needs) {
|
||||
needs.settings({ hledger_enabled: true });
|
||||
|
||||
@@ -188,12 +242,15 @@ acceptance("Hledger plugin", function (needs) {
|
||||
server.get(`/hledger/topics/${TOPIC_ID}/reports/income_statement`, () =>
|
||||
helper.response(incomeStatementReport)
|
||||
);
|
||||
server.get(`/hledger/topics/${TOPIC_ID}/reports/transactions`, () =>
|
||||
helper.response(transactionsReport)
|
||||
);
|
||||
});
|
||||
|
||||
test("renders the dashboard in place of the journal", async function (assert) {
|
||||
await visit("/t/-/45");
|
||||
|
||||
assert.dom(".hledger-dashboard__toolbar .btn").exists({ count: 4 });
|
||||
assert.dom(".hledger-dashboard__toolbar .btn").exists({ count: 5 });
|
||||
assert
|
||||
.dom(".hledger-dashboard__toolbar .btn:nth-of-type(1)")
|
||||
.hasText("Accounts");
|
||||
@@ -206,6 +263,9 @@ acceptance("Hledger plugin", function (needs) {
|
||||
assert
|
||||
.dom(".hledger-dashboard__toolbar .btn:nth-of-type(4)")
|
||||
.hasText("Equity");
|
||||
assert
|
||||
.dom(".hledger-dashboard__toolbar .btn:nth-of-type(5)")
|
||||
.hasText("Transactions");
|
||||
assert
|
||||
.dom(
|
||||
".hledger-dashboard__toolbar .btn:nth-of-type(2) .d-icon-scale-balanced"
|
||||
@@ -342,4 +402,28 @@ acceptance("Hledger plugin", function (needs) {
|
||||
.dom('.hledger-dashboard__account[title="expenses:hosting:server"]')
|
||||
.hasText("Server");
|
||||
});
|
||||
|
||||
test("shows the transaction log", async function (assert) {
|
||||
await visit("/t/-/45");
|
||||
|
||||
await click(".hledger-dashboard__toolbar .btn:nth-of-type(5)");
|
||||
|
||||
assert
|
||||
.dom(".hledger-dashboard__transaction")
|
||||
.exists({ count: 2 }, "renders one block per transaction");
|
||||
assert
|
||||
.dom(
|
||||
".hledger-dashboard__transaction:nth-of-type(1) .hledger-dashboard__transaction-date"
|
||||
)
|
||||
.hasText("2024-01-01", "shows the transaction date");
|
||||
assert
|
||||
.dom(
|
||||
".hledger-dashboard__transaction:nth-of-type(1) .hledger-dashboard__transaction-description"
|
||||
)
|
||||
.hasText("Opening balances", "shows the transaction description");
|
||||
assert
|
||||
.dom(".hledger-dashboard__table")
|
||||
.includesText("assets:bank:checking");
|
||||
assert.dom(".hledger-dashboard__table").includesText("1000.00 EUR");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user