Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete max value for the eth unit #60

Merged
merged 2 commits into from
Jun 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions pages/eth-unit-conversion.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,27 @@ describe(EthUnitConversion.name, () => {
),
);
});

it('calculates huge numbers', async () => {
const root = render(<EthUnitConversion />);
const weiField = (await root.findByLabelText(/^wei/i)) as HTMLInputElement;
const gweiField = (await root.findByLabelText(/gwei/i)) as HTMLInputElement;
const ethField = (await root.findByLabelText(/eth/i)) as HTMLInputElement;

fireEvent.change(gweiField, {
target: {
value: '100000000000000000000000000000000000000000000000000000000',
},
});

expect(weiField.value).toEqual(
'100000000000000000000000000000000000000000000000000000000000000000',
);
expect(gweiField.value).toEqual(
'100000000000000000000000000000000000000000000000000000000',
);
expect(ethField.value).toEqual(
'100000000000000000000000000000000000000000000000',
);
});
});
3 changes: 1 addition & 2 deletions src/misc/unitSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ export const unitSchema = z.preprocess(
message:
"The value mustn't contain letters or any special signs except dot",
})
.min(1, { message: 'The value must be longer than 1 digit' })
.max(26, { message: 'The value must be shorter than 26 digits' }),
.min(1, { message: 'The value must be longer than 1 digit' }),
);