Start the setup wizard blank and add a Run setup again button
The first-run seed no longer inserts the original vendor's name, address, contact details, PAN or bank account; the wizard now starts empty and requires a name and state. Settings > Data gets a Run setup again button that clears the onboarded flag. Re-running the wizard keeps the active invoice series unless the prefix or padding changes. The sample logo moves out of public/ so it no longer ships in the app.
This commit is contained in:
+26
-4
@@ -7,7 +7,8 @@ import type { BankAccount, Invoice, InvoiceInput, Settings } from "./types";
|
||||
|
||||
/**
|
||||
* The end-to-end invoice flow through the real IPC, run against the fresh database the self-test
|
||||
* launches with (it seeds the unregistered vendor, a default bank and an active series).
|
||||
* launches with. The fresh database is neutral (no vendor, no bank), so the first step provisions a
|
||||
* fake vendor and bank the way the setup wizard would.
|
||||
*/
|
||||
|
||||
const today = () => {
|
||||
@@ -28,11 +29,32 @@ export async function runE2eSteps(log: StepLog, reportPath: string): Promise<voi
|
||||
let bank!: BankAccount;
|
||||
let invoice: Invoice | null = null;
|
||||
|
||||
const loaded = await log.run("e2e: get settings and default bank", async () => {
|
||||
const loaded = await log.run("e2e: provision vendor and bank, get settings", async () => {
|
||||
s = await api.getSettings();
|
||||
const banks = await api.listBanks();
|
||||
let banks = await api.listBanks();
|
||||
if (banks.length === 0) {
|
||||
const saved = await api.saveBank({
|
||||
id: null,
|
||||
label: "Primary",
|
||||
bankName: "Self-test Bank",
|
||||
accountName: "Self-test Vendor",
|
||||
accountNo: "000000000000",
|
||||
branch: "000001",
|
||||
ifsc: "TEST0000001",
|
||||
isDefault: true,
|
||||
});
|
||||
s = await api.saveSettings({
|
||||
...s,
|
||||
vendorName: s.vendorName || "Self-test Vendor",
|
||||
vendorAddress: s.vendorAddress || "1 Test Road, Bengaluru - 560001",
|
||||
vendorStateCode: s.vendorStateCode || "29",
|
||||
defaultBankId: saved.id,
|
||||
onboarded: true,
|
||||
});
|
||||
banks = await api.listBanks();
|
||||
}
|
||||
const found = banks.find((b) => b.id === s.defaultBankId) ?? banks[0];
|
||||
if (!found) throw new Error("the fresh database has no bank account");
|
||||
if (!found) throw new Error("no bank account after provisioning");
|
||||
bank = found;
|
||||
return `${s.vendorName}, ${s.gstRegistration}, state ${s.vendorStateCode}, bank "${bank.label}"`;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user