refactor: address frontend review feedback
Frontend verify / commits (pull_request) Successful in 29s
Frontend verify / security (pull_request) Successful in 9s
Frontend verify / verify (pull_request) Successful in 8m54s
Frontend verify / commits (push) Skipped
Frontend verify / security (push) Successful in 12s
Frontend verify / verify (push) Successful in 9m59s
Frontend verify / commits (pull_request) Successful in 29s
Frontend verify / security (pull_request) Successful in 9s
Frontend verify / verify (pull_request) Successful in 8m54s
Frontend verify / commits (push) Skipped
Frontend verify / security (push) Successful in 12s
Frontend verify / verify (push) Successful in 9m59s
This commit was merged in pull request #43.
This commit is contained in:
@@ -30,7 +30,7 @@ function createAuthWrapper(
|
||||
describe("AuthProvider", () => {
|
||||
it("authorizes requests after restoring the initial session", async () => {
|
||||
let authorization: null | string
|
||||
// eslint-disable-next-line unicorn/no-null -- Exercise the explicit null returned by the production API/DOM contract.
|
||||
|
||||
= null;
|
||||
|
||||
server.use(
|
||||
@@ -234,12 +234,12 @@ describe("AuthProvider", () => {
|
||||
});
|
||||
expect(
|
||||
result.current.user?.id
|
||||
// eslint-disable-next-line unicorn/no-null -- Exercise the explicit null returned by the production API/DOM contract.
|
||||
|
||||
?? null,
|
||||
).toBe(
|
||||
loginAfterLogout
|
||||
? "b"
|
||||
: null, // eslint-disable-line unicorn/no-null -- Exercise the explicit null returned by the production API/DOM contract.
|
||||
: null,
|
||||
);
|
||||
expect(order).toEqual([
|
||||
"refresh-start",
|
||||
|
||||
@@ -30,9 +30,7 @@ const InstrumentPosition: FC<InstrumentPositionProps> = (props) => {
|
||||
<InstrumentSection state={vm.positionState} title={t("stock.position")}>
|
||||
{!!vm.position && (
|
||||
<Stack gap="md">
|
||||
{!!vm.position.isStale && (
|
||||
<Alert color="orange">{t("portfolio.staleWarning")}</Alert>
|
||||
)}
|
||||
{!!vm.position.isStale && <Alert color="orange">{t("portfolio.staleWarning")}</Alert>}
|
||||
|
||||
<div className={`${classes.metrics} ${classes.holding}`}>
|
||||
<div>
|
||||
@@ -103,9 +101,7 @@ const InstrumentPosition: FC<InstrumentPositionProps> = (props) => {
|
||||
{account.account.name}
|
||||
</Anchor>
|
||||
)
|
||||
: (
|
||||
<Text>{t("stock.portfolio")}</Text>
|
||||
)}
|
||||
: <Text>{t("stock.portfolio")}</Text>}
|
||||
|
||||
<div>
|
||||
<Text c="dimmed" size="xs">
|
||||
|
||||
@@ -82,9 +82,7 @@ const InstrumentSection: FC<InstrumentSectionProps> = (props) => {
|
||||
|
||||
{!!props.state.stale && <Text size="xs">{t("investment.stale")}</Text>}
|
||||
|
||||
{!!props.state.partial && (
|
||||
<Text role="status">{t("investment.partial")}</Text>
|
||||
)}
|
||||
{!!props.state.partial && <Text role="status">{t("investment.partial")}</Text>}
|
||||
|
||||
{!!props.state.lastSuccessfulAt && (
|
||||
<Text c="dimmed" size="xs">
|
||||
|
||||
@@ -135,12 +135,11 @@ describe("page-owned screen synchronization", () => {
|
||||
expect(modes).toEqual(
|
||||
cached
|
||||
? [
|
||||
null, // eslint-disable-line unicorn/no-null -- Preserve explicit null in the API fixture.
|
||||
// eslint-disable-next-line unicorn/no-null -- Exercise the explicit null returned by the production API/DOM contract.
|
||||
null,
|
||||
null,
|
||||
"observe",
|
||||
]
|
||||
: [null, "observe"], // eslint-disable-line unicorn/no-null -- Preserve explicit null in the API fixture.
|
||||
: [null, "observe"],
|
||||
);
|
||||
expect(posts).toBe(0);
|
||||
expect(result.current.disabled.data).toBeUndefined();
|
||||
@@ -316,7 +315,7 @@ describe("page-owned screen synchronization", () => {
|
||||
|
||||
await waitFor(() => expect(result.current.accounts.isSuccess).toBe(true));
|
||||
expect(result.current.accounts.data).toEqual([]);
|
||||
// eslint-disable-next-line unicorn/no-null -- Preserve the API/DOM null sentinel in the expected response.
|
||||
|
||||
expect(modes).toEqual([null, "observe"]);
|
||||
expect(
|
||||
queryClient
|
||||
@@ -357,8 +356,6 @@ describe("page-owned screen synchronization", () => {
|
||||
http.get("*/api/v1/tbank-sync/:id", () => {
|
||||
polls++;
|
||||
|
||||
/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
|
||||
|
||||
return HttpResponse.json(
|
||||
{
|
||||
errorCode: null,
|
||||
@@ -369,7 +366,6 @@ describe("page-owned screen synchronization", () => {
|
||||
scope: { screen: "accounts" },
|
||||
state: "succeeded",
|
||||
},
|
||||
/* eslint-enable unicorn/no-null */
|
||||
);
|
||||
}),
|
||||
);
|
||||
@@ -397,14 +393,14 @@ describe("page-owned screen synchronization", () => {
|
||||
expect(result.current.accounts.meta?.stateVersion).toBe("2"),
|
||||
);
|
||||
expect(bodies).toEqual([{ screen: "accounts" }]);
|
||||
// eslint-disable-next-line unicorn/no-null -- Preserve the API/DOM null sentinel in the expected response.
|
||||
|
||||
expect(modes).toEqual([null, "observe"]);
|
||||
vi.useFakeTimers();
|
||||
|
||||
try {
|
||||
await act(() => vi.advanceTimersByTimeAsync(120_000));
|
||||
expect(polls).toBe(1);
|
||||
// eslint-disable-next-line unicorn/no-null -- Preserve the API/DOM null sentinel in the expected response.
|
||||
|
||||
expect(modes).toEqual([null, "observe"]);
|
||||
unmount();
|
||||
await vi.advanceTimersByTimeAsync(120_000);
|
||||
@@ -429,10 +425,10 @@ describe("page-owned screen synchronization", () => {
|
||||
resource(
|
||||
isCompleted
|
||||
? []
|
||||
: null, // eslint-disable-line unicorn/no-null -- Preserve the nullable API fixture.
|
||||
: null,
|
||||
{
|
||||
stateVersion: isCompleted ? "covered" : "initial",
|
||||
sync: { errorCode: null, id: "history", state: "running" }, // eslint-disable-line unicorn/no-null -- Preserve explicit null in the API fixture.
|
||||
sync: { errorCode: null, id: "history", state: "running" },
|
||||
},
|
||||
);
|
||||
|
||||
@@ -445,8 +441,6 @@ describe("page-owned screen synchronization", () => {
|
||||
http.get("*/api/v1/tbank-sync/:id", () => {
|
||||
polls++;
|
||||
|
||||
/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
|
||||
|
||||
return HttpResponse.json(
|
||||
{
|
||||
errorCode: null,
|
||||
@@ -461,7 +455,6 @@ describe("page-owned screen synchronization", () => {
|
||||
scope: null,
|
||||
state: "running",
|
||||
},
|
||||
/* eslint-enable unicorn/no-null */
|
||||
);
|
||||
}),
|
||||
);
|
||||
@@ -493,7 +486,7 @@ describe("page-owned screen synchronization", () => {
|
||||
await act(async () => {
|
||||
await new Promise(resolve => setTimeout(resolve, 1100));
|
||||
});
|
||||
// eslint-disable-next-line unicorn/no-null -- Preserve the API/DOM null sentinel in the expected response.
|
||||
|
||||
expect(modes).toEqual([null, "observe"]);
|
||||
if (boundary === "leave") unmount();
|
||||
else act(() => configureAuthClient());
|
||||
@@ -515,12 +508,11 @@ describe("page-owned screen synchronization", () => {
|
||||
http.get("*/api/v1/brokerage-accounts", () =>
|
||||
HttpResponse.json(
|
||||
resource(
|
||||
/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
|
||||
|
||||
[],
|
||||
{
|
||||
sync: { errorCode: null, id: "revoked", state: "running" },
|
||||
},
|
||||
/* eslint-enable unicorn/no-null */
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -550,7 +542,7 @@ describe("page-owned screen synchronization", () => {
|
||||
const modes: (null | string)[] = [];
|
||||
|
||||
const dependency = resource(
|
||||
/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
|
||||
|
||||
[],
|
||||
{
|
||||
resourceKey: "operations",
|
||||
@@ -561,7 +553,6 @@ describe("page-owned screen synchronization", () => {
|
||||
state: isObserved ? "idle" : "running",
|
||||
},
|
||||
},
|
||||
/* eslint-enable unicorn/no-null */
|
||||
).meta;
|
||||
|
||||
server.use(
|
||||
@@ -574,7 +565,7 @@ describe("page-owned screen synchronization", () => {
|
||||
resource(
|
||||
isObserved
|
||||
? []
|
||||
: null, // eslint-disable-line unicorn/no-null -- Exercise the explicit null returned by the production API/DOM contract.
|
||||
: null,
|
||||
{
|
||||
dependencies: [
|
||||
{
|
||||
@@ -588,7 +579,7 @@ describe("page-owned screen synchronization", () => {
|
||||
);
|
||||
}),
|
||||
http.get("*/api/v1/tbank-sync/:id", () =>
|
||||
/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
|
||||
|
||||
HttpResponse.json(
|
||||
{
|
||||
errorCode: null,
|
||||
@@ -599,7 +590,6 @@ describe("page-owned screen synchronization", () => {
|
||||
scope: null,
|
||||
state: "succeeded",
|
||||
},
|
||||
/* eslint-enable unicorn/no-null */
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -615,7 +605,7 @@ describe("page-owned screen synchronization", () => {
|
||||
);
|
||||
|
||||
await waitFor(() => expect(result.current.data).toEqual([]));
|
||||
// eslint-disable-next-line unicorn/no-null -- Preserve the API/DOM null sentinel in the expected response.
|
||||
|
||||
expect(modes).toEqual([null, "observe"]);
|
||||
});
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ function useScreenSync(scope: InvestmentScreen, resources: ScreenResource[]) {
|
||||
finally {
|
||||
if (requestInFlightRef.current === scopeKey)
|
||||
requestInFlightRef.current
|
||||
// eslint-disable-next-line unicorn/no-null -- Preserve the nullable domain value consumed by this view model.
|
||||
|
||||
= null;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -48,8 +48,6 @@ describe("sync connection and session boundaries", () => {
|
||||
started += 1;
|
||||
await blocked;
|
||||
|
||||
/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
|
||||
|
||||
return HttpResponse.json(
|
||||
{
|
||||
...accepted,
|
||||
@@ -59,7 +57,6 @@ describe("sync connection and session boundaries", () => {
|
||||
resources: [],
|
||||
state: "succeeded",
|
||||
},
|
||||
/* eslint-enable unicorn/no-null */
|
||||
);
|
||||
}),
|
||||
);
|
||||
@@ -103,13 +100,12 @@ describe("sync connection and session boundaries", () => {
|
||||
|
||||
if (boundary === "connection")
|
||||
commitTbankConnectionBoundary(
|
||||
/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
|
||||
|
||||
queryClient,
|
||||
{
|
||||
connected: false,
|
||||
connectedAt: null,
|
||||
},
|
||||
/* eslint-enable unicorn/no-null */
|
||||
);
|
||||
else {
|
||||
generation += 1;
|
||||
|
||||
+3
-4
@@ -77,7 +77,7 @@ function renderSection(client: QueryClient) {
|
||||
|
||||
function seededClient() {
|
||||
const client = createTestQueryClient();
|
||||
/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
|
||||
|
||||
client.setQueryData(brokerageAccountsQueryKey, [
|
||||
{
|
||||
id: "account-1",
|
||||
@@ -85,7 +85,7 @@ function seededClient() {
|
||||
openedOn: null,
|
||||
type: "BROKERAGE",
|
||||
},
|
||||
/* eslint-enable unicorn/no-null */
|
||||
|
||||
]);
|
||||
client.setQueryData(portfolioQueryKey, { source: "previous-connection" });
|
||||
client.setQueryData(stockQueryKey, { source: "previous-connection" });
|
||||
@@ -157,10 +157,9 @@ describe("TbankConnectionSection", () => {
|
||||
|
||||
return reads === 1
|
||||
? HttpResponse.json({ code: "TBANK_UNAVAILABLE" }, { status: 503 })
|
||||
/* eslint-disable unicorn/no-null -- Fixture preserves the production contract’s explicit null values. */
|
||||
|
||||
: HttpResponse.json(
|
||||
{ connected: false, connectedAt: null },
|
||||
/* eslint-enable unicorn/no-null */
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -12,12 +12,8 @@ const TbankConnectionSection: FC = () => {
|
||||
if (viewModel.state === "loading") return <TbankConnectionLoading />;
|
||||
|
||||
return viewModel.state === "error"
|
||||
? (
|
||||
<TbankConnectionError retry={viewModel.retry} />
|
||||
)
|
||||
: (
|
||||
<TbankConnectionSectionLoaded {...viewModel} />
|
||||
);
|
||||
? <TbankConnectionError retry={viewModel.retry} />
|
||||
: <TbankConnectionSectionLoaded {...viewModel} />;
|
||||
};
|
||||
|
||||
export { TbankConnectionSection };
|
||||
|
||||
+1
-3
@@ -129,9 +129,7 @@ const TbankConnectionSectionLoaded: FC<TbankConnectionSectionLoadedProps> = (
|
||||
<Stack>
|
||||
<Text>{t("tbank.deleteText")}</Text>
|
||||
|
||||
{remove.isError && (
|
||||
<Alert color="red">{t("tbank.requestError")}</Alert>
|
||||
)}
|
||||
{remove.isError && <Alert color="red">{t("tbank.requestError")}</Alert>}
|
||||
|
||||
<Button
|
||||
color="red"
|
||||
|
||||
-1
@@ -59,7 +59,6 @@ function useTbankConnectionSectionLoadedVm(
|
||||
commitTbankConnectionBoundary(queryClient, {
|
||||
connected: false,
|
||||
connectedAt:
|
||||
// eslint-disable-next-line unicorn/no-null -- The disconnected API snapshot requires a null connection timestamp.
|
||||
null,
|
||||
});
|
||||
setIsDeleteOpened(false);
|
||||
|
||||
Reference in New Issue
Block a user