Skip to content

Conversation

@heorhi-deriv
Copy link
Contributor

@heorhi-deriv heorhi-deriv commented Sep 25, 2023

Changes:

In this PR we added Counter for wallet transfer operations

Screenshots:

Screenshot 2023-09-26 at 13 10 51

@vercel
Copy link

vercel bot commented Sep 25, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
deriv-app ✅ Ready (Inspect) Visit Preview Sep 26, 2023 1:20pm

@heorhi-deriv heorhi-deriv changed the title george / WALL-1832 / counter implementation george / WALL-1832 / timer implementation Sep 25, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Sep 25, 2023

A production App ID was automatically generated for this PR. (log)

Click here to copy & paste above information.
- **PR**: [https://github.com/binary-com/deriv-app/pull/10278](https://github.com/binary-com/deriv-app/pull/10278)
- **URLs**:
    - **w/ App ID + Server**: https://deriv-app-git-fork-heorhi-deriv-crypto-counter.binary.sx?qa_server=red.binaryws.com&app_id=32194
    - **Original**: https://deriv-app-git-fork-heorhi-deriv-crypto-counter.binary.sx
- **App ID**: `32194`

@github-actions
Copy link
Contributor

github-actions bot commented Sep 25, 2023

🚨 Lighthouse report for the changes in this PR:

Category Score
🔺 Performance 21
🟧 Accessibility 75
🟧 Best practices 83
🟧 SEO 85
🟢 PWA 90

Lighthouse ran with https://deriv-app-git-fork-heorhi-deriv-crypto-counter.binary.sx/

@coveralls
Copy link

Coverage Status

coverage: 11.254% (-0.001%) from 11.255% when pulling 07e1115 on heorhi-deriv:crypto-counter into c543558 on binary-com:feature/wallets_with_traders_hub_2.

@markw-deriv
Copy link
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();
    });
});

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@nijil-deriv nijil-deriv merged commit ef553cd into deriv-com:feature/wallets_with_traders_hub_2 Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants