fix(account): show source metadata on empty account and income (WealthLedger/frontend#55) (#133)
This commit was merged in pull request #133.
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import { expect, it } from "vitest";
|
||||
|
||||
import { ApiErrorCode, apiErrorCode, isApiErrorCode } from "./problem-details";
|
||||
import {
|
||||
ApiErrorCode,
|
||||
apiErrorCode,
|
||||
isApiErrorCode,
|
||||
isBrokerageAccessLoss,
|
||||
} from "./problem-details";
|
||||
|
||||
it("matches known codes and preserves unknown wire codes for fallback handling", () => {
|
||||
expect(
|
||||
@@ -16,3 +21,10 @@ it("matches known codes and preserves unknown wire codes for fallback handling",
|
||||
expect(apiErrorCode(null)).toBeUndefined();
|
||||
expect(apiErrorCode({})).toBeUndefined();
|
||||
});
|
||||
|
||||
it("separates brokerage access loss from UNAUTHORIZED, temporary and unknown codes", () => {
|
||||
for (const code of ["INVALID_TBANK_TOKEN", "NOT_FOUND", "TBANK_NOT_CONNECTED"])
|
||||
expect(isBrokerageAccessLoss(code)).toBe(true);
|
||||
for (const code of ["UNAUTHORIZED", "TBANK_UNAVAILABLE", "FUTURE_PROVIDER_ERROR", undefined])
|
||||
expect(isBrokerageAccessLoss(code)).toBe(false);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user