Merge commit '3685f8cf' into HEAD

This commit is contained in:
Sebastian 2022-10-25 19:20:22 -03:00
commit c747ae6036
No known key found for this signature in database
GPG Key ID: BE4FF68352439FC1
8 changed files with 3533 additions and 5239 deletions

View File

@ -53,16 +53,16 @@
"yup": "^0.32.9" "yup": "^0.32.9"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.13.16", "@babel/core": "7.18.9",
"@babel/plugin-transform-react-jsx-source": "^7.12.13", "@babel/plugin-transform-react-jsx-source": "7.18.6",
"@creativebulma/bulma-tooltip": "^1.2.0", "@creativebulma/bulma-tooltip": "^1.2.0",
"@gnu-taler/pogen": "^0.0.5", "@gnu-taler/pogen": "^0.0.5",
"@linaria/babel-preset": "^3.0.0-beta.4", "@linaria/babel-preset": "3.0.0-beta.22",
"@linaria/core": "^3.0.0-beta.4", "@linaria/core": "3.0.0-beta.22",
"@linaria/react": "^3.0.0-beta.7", "@linaria/react": "3.0.0-beta.22",
"@linaria/rollup": "^3.0.0-beta.7", "@linaria/rollup": "3.0.0-beta.22",
"@linaria/shaker": "^3.0.0-beta.7", "@linaria/shaker": "3.0.0-beta.22",
"@linaria/webpack-loader": "^3.0.0-beta.7", "@linaria/webpack-loader": "3.0.0-beta.22",
"@rollup/plugin-alias": "^3.1.5", "@rollup/plugin-alias": "^3.1.5",
"@rollup/plugin-babel": "^5.3.0", "@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^20.0.0", "@rollup/plugin-commonjs": "^20.0.0",

View File

@ -55,8 +55,8 @@
"yup": "^0.32.9" "yup": "^0.32.9"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.13.16", "@babel/core": "7.18.9",
"@babel/plugin-transform-react-jsx-source": "^7.12.13", "@babel/plugin-transform-react-jsx-source": "7.18.6",
"@creativebulma/bulma-tooltip": "^1.2.0", "@creativebulma/bulma-tooltip": "^1.2.0",
"@gnu-taler/pogen": "^0.0.5", "@gnu-taler/pogen": "^0.0.5",
"@storybook/addon-a11y": "^6.2.9", "@storybook/addon-a11y": "^6.2.9",

View File

@ -44,16 +44,16 @@
} }
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "7.13.16", "@babel/core": "7.18.9",
"@babel/plugin-transform-modules-commonjs": "^7.18.2", "@babel/runtime": "7.18.9",
"@babel/plugin-transform-react-jsx-source": "^7.12.13", "@babel/plugin-transform-modules-commonjs": "7.18.6",
"@babel/preset-typescript": "^7.13.0", "@babel/plugin-transform-react-jsx-source": "7.18.6",
"@babel/runtime": "^7.17.8", "@babel/preset-typescript": "7.18.6",
"@gnu-taler/pogen": "workspace:*", "@gnu-taler/pogen": "workspace:*",
"@linaria/babel-preset": "3.0.0-beta.4", "@linaria/babel-preset": "3.0.0-beta.22",
"@linaria/core": "3.0.0-beta.4", "@linaria/core": "3.0.0-beta.22",
"@linaria/react": "3.0.0-beta.4", "@linaria/react": "3.0.0-beta.22",
"@linaria/webpack-loader": "3.0.0-beta.4", "@linaria/webpack-loader": "3.0.0-beta.22",
"@testing-library/preact": "^2.0.1", "@testing-library/preact": "^2.0.1",
"@testing-library/preact-hooks": "^1.1.0", "@testing-library/preact-hooks": "^1.1.0",
"@types/chai": "^4.3.0", "@types/chai": "^4.3.0",

View File

@ -81,8 +81,8 @@ export function Modal({
return ( return (
<Portal <Portal
ref={handlePortalRef} // ref={mountNodeRef}
container={container} // container={container}
// disablePortal={disablePortal} // disablePortal={disablePortal}
> >
<div <div

View File

@ -92,7 +92,7 @@ export const Portal = forwardRef(function Portal(
) : ( ) : (
<Fragment /> <Fragment />
); );
}); } as any);
function getContainer(container: any): any { function getContainer(container: any): any {
return typeof container === "function" ? container() : container; return typeof container === "function" ? container() : container;

View File

@ -26,8 +26,7 @@ function getJsonIfOk(r: Response): Promise<any> {
} }
throw new Error( throw new Error(
`Try another server: (${r.status}) ${ `Try another server: (${r.status}) ${r.statusText || "internal server error"
r.statusText || "internal server error"
}`, }`,
); );
} }
@ -100,7 +99,7 @@ export function compose<SType extends { status: string }, PType>(
const viewComponent = viewMap[statusName] as unknown as StateFunc<SType>; const viewComponent = viewMap[statusName] as unknown as StateFunc<SType>;
return createElement(viewComponent, state); return createElement(viewComponent, state);
} }
TheComponent.name = `${name}`; // TheComponent.name = `${name}`;
return TheComponent; return TheComponent;
} }

View File

@ -239,44 +239,81 @@ describe("DepositPage states", () => {
expect(r.currency).eq(currency); expect(r.currency).eq(currency);
expect(r.account.value).eq(accountSelected); expect(r.account.value).eq(accountSelected);
expect(r.amount.value).eq("0"); expect(r.amount.value).eq("0");
expect(r.depositHandler.onClick).undefined;
expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:0`));
r.amount.onInput("10");
}
expect(await waitForStateUpdate()).true;
{
const r = pullLastResultOrThrow();
if (r.status !== "ready") expect.fail();
expect(r.cancelHandler.onClick).not.undefined;
expect(r.currency).eq(currency);
expect(r.account.value).eq(accountSelected);
expect(r.amount.value).eq("10");
expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:0`)); expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:0`));
expect(r.depositHandler.onClick).undefined; expect(r.depositHandler.onClick).undefined;
r.amount.onInput("3");
}
expect(await waitForStateUpdate()).true;
{
const r = pullLastResultOrThrow();
if (r.status !== "ready") expect.fail();
expect(r.cancelHandler.onClick).not.undefined;
expect(r.currency).eq(currency);
expect(r.account.value).eq(accountSelected);
expect(r.amount.value).eq("3");
expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:0`));
expect(r.depositHandler.onClick).not.undefined;
} }
await assertNoPendingUpdate(); await assertNoPendingUpdate();
expect(handler.getCallingQueueState()).eq("empty")
}); });
// it("should calculate the fee upon entering amount ", async () => {
// const { pullLastResultOrThrow, waitForStateUpdate, assertNoPendingUpdate } =
// mountHook(() =>
// useComponentState(
// { currency, onCancel: nullFunction, onSuccess: nullFunction },
// {
// getBalance: async () =>
// ({
// balances: [{ available: `${currency}:1` }],
// } as Partial<BalancesResponse>),
// listKnownBankAccounts: async () => ({ accounts: [ibanPayto] }),
// getFeeForDeposit: withSomeFee,
// } as Partial<typeof wxApi> as any,
// ),
// );
// {
// const { status } = getLastResultOrThrow();
// expect(status).equal("loading");
// }
// await waitNextUpdate();
// {
// const r = getLastResultOrThrow();
// if (r.status !== "ready") expect.fail();
// expect(r.cancelHandler.onClick).not.undefined;
// expect(r.currency).eq(currency);
// expect(r.account.value).eq(accountSelected);
// expect(r.amount.value).eq("0");
// expect(r.depositHandler.onClick).undefined;
// expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:0`));
// r.amount.onInput("10");
// }
// expect(await waitForStateUpdate()).true;
// {
// const r = pullLastResultOrThrow();
// if (r.status !== "ready") expect.fail();
// expect(r.cancelHandler.onClick).not.undefined;
// expect(r.currency).eq(currency);
// expect(r.account.value).eq(accountSelected);
// expect(r.amount.value).eq("10");
// expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:0`));
// expect(r.depositHandler.onClick).undefined;
// r.amount.onInput("3");
// }
// expect(await waitForStateUpdate()).true;
// {
// const r = pullLastResultOrThrow();
// if (r.status !== "ready") expect.fail();
// expect(r.cancelHandler.onClick).not.undefined;
// expect(r.currency).eq(currency);
// expect(r.account.value).eq(accountSelected);
// expect(r.amount.value).eq("3");
// expect(r.totalFee).deep.eq(Amounts.parseOrThrow(`${currency}:0`));
// expect(r.depositHandler.onClick).not.undefined;
// }
// await assertNoPendingUpdate();
// expect(handler.getCallingQueueState()).eq("empty")
// });
it("should calculate the fee upon entering amount ", async () => { it("should calculate the fee upon entering amount ", async () => {
const { handler, mock } = createWalletApiMock(); const { handler, mock } = createWalletApiMock();
const props = { currency, onCancel: nullFunction, onSuccess: nullFunction } const props = { currency, onCancel: nullFunction, onSuccess: nullFunction }

File diff suppressed because it is too large Load Diff