-
Notifications
You must be signed in to change notification settings - Fork 392
george / WALL-1832 / timer implementation #10278
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
Merged
nijil-deriv
merged 3 commits into
deriv-com:feature/wallets_with_traders_hub_2
from
heorhi-deriv:crypto-counter
Sep 28, 2023
Merged
george / WALL-1832 / timer implementation #10278
nijil-deriv
merged 3 commits into
deriv-com:feature/wallets_with_traders_hub_2
from
heorhi-deriv:crypto-counter
Sep 28, 2023
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
heorhi-deriv
commented
Sep 25, 2023
packages/appstore/src/components/wallet-transfer/timer/timer.tsx
Outdated
Show resolved
Hide resolved
Contributor
|
A production App ID was automatically generated for this PR. (log)
Click here to copy & paste above information. |
Contributor
|
🚨 Lighthouse report for the changes in this PR:
Lighthouse ran with https://deriv-app-git-fork-heorhi-deriv-crypto-counter.binary.sx/ |
rostislav-deriv
approved these changes
Sep 25, 2023
27ee517 to
3535830
Compare
Contributor
|
Could probably write a small unit test for this too: import React from 'react';
import { render, act } from '@testing-library/react';
import Timer from './path-to-your-timer-component'; // Update the path accordingly
jest.useFakeTimers();
describe('<Timer />', () => {
it('starts the countdown automatically', () => {
const countdown = {
count: 5,
reset: jest.fn(),
start: jest.fn(),
};
render(<Timer countdown={countdown} />);
expect(countdown.start).toHaveBeenCalledTimes(1);
});
it('calls onComplete when countdown reaches zero', () => {
const onComplete = jest.fn();
const countdown = {
count: 1,
reset: jest.fn(),
start: jest.fn(() => {
countdown.count = 0;
}),
};
render(<Timer countdown={countdown} onComplete={onComplete} />);
act(() => {
jest.runAllTimers();
});
expect(onComplete).toHaveBeenCalledTimes(1);
});
it('resets the countdown after reaching zero', () => {
const countdown = {
count: 1,
reset: jest.fn(),
start: jest.fn(() => {
countdown.count = 0;
}),
};
render(<Timer countdown={countdown} />);
act(() => {
jest.runAllTimers();
});
expect(countdown.reset).toHaveBeenCalledTimes(1);
});
it('displays the correct countdown time', () => {
const countdown = {
count: 5,
reset: jest.fn(),
start: jest.fn(),
};
const { getByText } = render(<Timer countdown={countdown} />);
expect(getByText('5s')).toBeInTheDocument();
});
}); |
|
Kudos, SonarCloud Quality Gate passed! |
markw-deriv
approved these changes
Sep 26, 2023
nijil-deriv
approved these changes
Sep 28, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.








Changes:
In this PR we added Counter for wallet transfer operations
Screenshots: