refactor: enforce enum machine codes #18
Use owner enums for known codes; preserve wire values and unknown fallbacks. Verified npm ci and verify: 379 tests, 5 lint checks, app and Storybook builds.
This commit was merged in pull request #41.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { expect, it } from "vitest";
|
||||
|
||||
import { operationLabelKey } from "./display";
|
||||
|
||||
it.each([
|
||||
["OPERATION_TYPE_BUY", "buy"],
|
||||
["OPERATION_TYPE_BUY_CARD", "buy"],
|
||||
["OPERATION_TYPE_BUY_MARGIN", "buy"],
|
||||
["OPERATION_TYPE_SELL", "sell"],
|
||||
["OPERATION_TYPE_SELL_CARD", "sell"],
|
||||
["OPERATION_TYPE_SELL_MARGIN", "sell"],
|
||||
["OPERATION_TYPE_DIV_EXT", "dividend"],
|
||||
["OPERATION_TYPE_DIVIDEND", "dividend"],
|
||||
["OPERATION_TYPE_DIVIDEND_TRANSFER", "dividend"],
|
||||
["OPERATION_TYPE_INPUT_SECURITIES", "input"],
|
||||
["OPERATION_TYPE_OUTPUT_SECURITIES", "output"],
|
||||
["OPERATION_TYPE_FUTURE_TAX", "tax"],
|
||||
["OPERATION_TYPE_FUTURE_FEE", "fee"],
|
||||
["OPERATION_TYPE_TRANS_FUTURE", "transfer"],
|
||||
["FUTURE_UNKNOWN_OPERATION", "other"],
|
||||
])("preserves the wire operation label for %s", (type, label) => {
|
||||
expect(operationLabelKey(type)).toBe(`ledger.operationType.${label}`);
|
||||
});
|
||||
Reference in New Issue
Block a user