test: give the delete fixtures numbers apart from their id (#467)
A sort order equal to the id let a handler that passed the sort order pass the id assertion. The category fixtures of the CategoryDetailPanel and AccountsPage tests now carry a sort order (and a keyword count) of their own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
fdcca057cd
commit
ed49c74cc9
2 changed files with 12 additions and 10 deletions
|
|
@ -30,7 +30,8 @@ import type { CategoryFormData, CategoryTreeNode } from "../../shared/types";
|
||||||
|
|
||||||
const harness = hookHarness();
|
const harness = hookHarness();
|
||||||
|
|
||||||
const node = (id: number, parent_id: number | null, name: string): CategoryTreeNode => ({
|
/** A category whose numbers all differ from its id, so that only the id passes for it. */
|
||||||
|
const node = (id: number, parent_id: number | null, name: string, sort_order: number): CategoryTreeNode => ({
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
parent_id,
|
parent_id,
|
||||||
|
|
@ -39,14 +40,14 @@ const node = (id: number, parent_id: number | null, name: string): CategoryTreeN
|
||||||
type: "expense",
|
type: "expense",
|
||||||
is_active: true,
|
is_active: true,
|
||||||
is_inputable: true,
|
is_inputable: true,
|
||||||
sort_order: id,
|
sort_order,
|
||||||
keyword_count: 0,
|
keyword_count: 4,
|
||||||
i18n_key: null,
|
i18n_key: null,
|
||||||
children: [],
|
children: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
const HOUSING = node(1, null, "Logement");
|
const HOUSING = node(1, null, "Logement", 1);
|
||||||
const RENT = node(10, 1, "Loyer");
|
const RENT = node(10, 1, "Loyer", 2);
|
||||||
const EDITING: CategoryFormData = {
|
const EDITING: CategoryFormData = {
|
||||||
name: RENT.name,
|
name: RENT.name,
|
||||||
type: RENT.type,
|
type: RENT.type,
|
||||||
|
|
|
||||||
|
|
@ -36,12 +36,13 @@ import type { BalanceAccountWithCategory, BalanceCategory } from "../shared/type
|
||||||
|
|
||||||
const harness = hookHarness();
|
const harness = hookHarness();
|
||||||
|
|
||||||
const category = (id: number, key: string, is_seed = false): BalanceCategory => ({
|
/** A balance category; its sort order differs from its id, so that only the id passes for it. */
|
||||||
|
const category = (id: number, key: string, sort_order: number, is_seed = false): BalanceCategory => ({
|
||||||
id,
|
id,
|
||||||
key,
|
key,
|
||||||
i18n_key: `balance.category.${key}`,
|
i18n_key: `balance.category.${key}`,
|
||||||
kind: "simple",
|
kind: "simple",
|
||||||
sort_order: id,
|
sort_order,
|
||||||
is_active: true,
|
is_active: true,
|
||||||
is_seed,
|
is_seed,
|
||||||
asset_type: null,
|
asset_type: null,
|
||||||
|
|
@ -49,11 +50,11 @@ const category = (id: number, key: string, is_seed = false): BalanceCategory =>
|
||||||
});
|
});
|
||||||
|
|
||||||
/** A category of the user, without any account: the only one the page lets go. */
|
/** A category of the user, without any account: the only one the page lets go. */
|
||||||
const BOAT = category(21, "boat");
|
const BOAT = category(21, "boat", 1);
|
||||||
/** A category of the user, two accounts linked to it. */
|
/** A category of the user, two accounts linked to it. */
|
||||||
const ART = category(22, "art");
|
const ART = category(22, "art", 2);
|
||||||
/** A category of the seed, protected. */
|
/** A category of the seed, protected. */
|
||||||
const CASH = category(23, "cash", true);
|
const CASH = category(23, "cash", 3, true);
|
||||||
|
|
||||||
const account = (id: number, name: string, cat: BalanceCategory): BalanceAccountWithCategory => ({
|
const account = (id: number, name: string, cat: BalanceCategory): BalanceAccountWithCategory => ({
|
||||||
id,
|
id,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue