Skip to content
Open
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
71 changes: 71 additions & 0 deletions app/components/App/AvailableFunds/__tests__/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import React from 'react';
import { renderWithProviders } from '../../../../../internals/testing/redux-utils';
import AvailableFunds from '../index';

describe('<AvailableFunds />', () => {
it('should render without crashing', () => {
const initialState = {
global: {
user: {
name: 'Test User',
availableFunds: 2500.75,
},
isLogged: true,
},
};

const { container } = renderWithProviders(<AvailableFunds />, {
initialState,
});
expect(container.firstChild).toBeInTheDocument();
});

it('should render with different fund amounts', () => {
const initialState = {
global: {
user: {
name: 'Test User',
availableFunds: 10000.0,
},
isLogged: true,
},
};

const { container } = renderWithProviders(<AvailableFunds />, {
initialState,
});
expect(container.firstChild).toBeInTheDocument();
});

it('should handle zero funds', () => {
const initialState = {
global: {
user: {
name: 'Test User',
availableFunds: 0,
},
isLogged: true,
},
};

const { container } = renderWithProviders(<AvailableFunds />, {
initialState,
});
expect(container.firstChild).toBeInTheDocument();
});

it('should handle loading state', () => {
const initialState = {
global: {
user: { name: 'Test User' },
isLogged: true,
isLoading: true,
},
};

const { container } = renderWithProviders(<AvailableFunds />, {
initialState,
});
expect(container.firstChild).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`<BankCards /> should render a BankCards 1`] = `
<div
class="ant-card Cardstyle__StyledCard-s807iu-0 egrUQF ant-card-bordered"
class="ant-card styles__StyledCard-sc-1tq6noh-0 iKqrYo ant-card-bordered"
darker="true"
excluded="true"
shadowed="true"
Expand All @@ -22,11 +22,11 @@ exports[`<BankCards /> should render a BankCards 1`] = `
class="ant-card-extra"
>
<button
class="ant-btn Buttonstyle__StyledButton-nh59mr-0 bcqyjQ ant-btn-link"
class="ant-btn styles__StyledButton-sc-1v6up7w-0 dbPSWh ant-btn-link"
type="button"
>
<div
class="Buttonstyle__StyledButtonContent-nh59mr-1 cBxojI"
class="styles__StyledButtonContent-sc-1v6up7w-1 hBxiOV"
>
<span
aria-label="credit-card"
Expand Down Expand Up @@ -61,7 +61,7 @@ exports[`<BankCards /> should render a BankCards 1`] = `
class="ant-card-body"
>
<div
class="Cardstyle__StyledCardContent-s807iu-1 fnMJaW"
class="styles__StyledCardContent-sc-1tq6noh-1 bOAQsz"
>
<span>
The cards function is disabled.
Expand Down
62 changes: 53 additions & 9 deletions app/components/App/BankCards/__tests__/index.test.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,61 @@
import React from 'react';
import { render } from '@testing-library/react';
import { IntlProvider } from 'react-intl';
import { DEFAULT_LOCALE } from 'utils/locales';
import { renderWithProviders } from '../../../../../internals/testing/redux-utils';
import BankCards from '../index';
import 'utils/__tests__/__mocks__/matchMedia';

describe('<BankCards />', () => {
it('should render a BankCards', () => {
const { container } = render(
<IntlProvider locale={DEFAULT_LOCALE}>
<BankCards />
</IntlProvider>,
);
const initialState = {
global: {
user: {
cards: [
{ id: 1, number: '1234567890123456', type: 'visa', balance: 1000 },
],
},
},
};

const { container } = renderWithProviders(<BankCards />, { initialState });
expect(container.firstChild).toMatchSnapshot();
});

it('should render with empty cards array', () => {
const initialState = {
global: {
user: { cards: [] },
},
};

const { container } = renderWithProviders(<BankCards />, { initialState });
expect(container.firstChild).toBeInTheDocument();
});

it('should render with multiple cards', () => {
const initialState = {
global: {
user: {
cards: [
{ id: 1, number: '1234567890123456', type: 'visa', balance: 1000 },
{
id: 2,
number: '9876543210987654',
type: 'mastercard',
balance: 2000,
},
],
},
},
};

const { container } = renderWithProviders(<BankCards />, { initialState });
expect(container.firstChild).toBeInTheDocument();
});

it('should handle missing user data', () => {
const initialState = {
global: { user: null },
};

const { container } = renderWithProviders(<BankCards />, { initialState });
expect(container.firstChild).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`<BankInformation /> should render a BankInformation 1`] = `
<section
class="Widgetstyle__StyledWidget-sc-1bl1ktb-0 kjDbLh"
class="styles__StyledWidget-sc-1poowsd-0 iivFOM"
>
<div
class="Widgetstyle__StyledWidgetContent-sc-1bl1ktb-1 ctZsZP"
class="styles__StyledWidgetContent-sc-1poowsd-1 jQTuAG"
>
<div
class="Widgetstyle__StyledWidgetContentDescription-sc-1bl1ktb-6 glPtKX"
class="styles__StyledWidgetContentDescription-sc-1poowsd-6 cjhsDy"
>
Did you know that transfers in our bank arrive immediately?
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`<Bills /> should render a Bills 1`] = `
<div
class="ant-card Cardstyle__StyledCard-s807iu-0 heNqZU"
class="ant-card styles__StyledCard-sc-1tq6noh-0 fkKcRp"
darker="true"
loaded="1"
shadowed="true"
Expand All @@ -22,11 +22,11 @@ exports[`<Bills /> should render a Bills 1`] = `
class="ant-card-extra"
>
<button
class="ant-btn Buttonstyle__StyledButton-nh59mr-0 bcqyjQ ant-btn-link"
class="ant-btn styles__StyledButton-sc-1v6up7w-0 dbPSWh ant-btn-link"
type="button"
>
<div
class="Buttonstyle__StyledButtonContent-nh59mr-1 cBxojI"
class="styles__StyledButtonContent-sc-1v6up7w-1 hBxiOV"
>
<span
aria-label="plus-circle"
Expand Down Expand Up @@ -64,11 +64,11 @@ exports[`<Bills /> should render a Bills 1`] = `
class="ant-card-body"
>
<div
class="ant-spin ant-spin-spinning LoadingIndicatorstyle__StyledSpin-sc-1hamj2j-0 cVaifN"
class="ant-spin ant-spin-spinning styles__StyledSpin-sc-2p38ik-0 cPKCxh"
>
<span
aria-label="loading"
class="anticon anticon-loading LoadingIndicatorstyle__StyledLoadingOutlined-sc-1hamj2j-1 bgzkcd ant-spin-dot"
class="anticon anticon-loading styles__StyledLoadingOutlined-sc-2p38ik-1 izblzp ant-spin-dot"
role="img"
>
<svg
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`<Copyright /> should render a Copyright 1`] = `
<div
class="Copyrightstyle__StyledCopyright-sc-1dw2rfe-0 kybcIo"
class="styles__StyledCopyright-sc-1wbnq6f-0 dDdCto"
>
Copyright ©
2020
2025
. Made by

<a
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`<Credits /> should render a Credits 1`] = `
<div
class="ant-card Cardstyle__StyledCard-s807iu-0 egrUQF ant-card-bordered"
class="ant-card styles__StyledCard-sc-1tq6noh-0 iKqrYo ant-card-bordered"
darker="true"
excluded="true"
shadowed="true"
Expand All @@ -22,11 +22,11 @@ exports[`<Credits /> should render a Credits 1`] = `
class="ant-card-extra"
>
<button
class="ant-btn Buttonstyle__StyledButton-nh59mr-0 bcqyjQ ant-btn-link"
class="ant-btn styles__StyledButton-sc-1v6up7w-0 dbPSWh ant-btn-link"
type="button"
>
<div
class="Buttonstyle__StyledButtonContent-nh59mr-1 cBxojI"
class="styles__StyledButtonContent-sc-1v6up7w-1 hBxiOV"
>
<span
aria-label="line-chart"
Expand Down Expand Up @@ -61,7 +61,7 @@ exports[`<Credits /> should render a Credits 1`] = `
class="ant-card-body"
>
<div
class="Cardstyle__StyledCardContent-s807iu-1 fnMJaW"
class="styles__StyledCardContent-sc-1tq6noh-1 bOAQsz"
>
<span>
The credits function is disabled.
Expand Down
55 changes: 46 additions & 9 deletions app/components/App/Credits/__tests__/index.test.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,54 @@
import React from 'react';
import { render } from '@testing-library/react';
import { IntlProvider } from 'react-intl';
import { DEFAULT_LOCALE } from 'utils/locales';
import { renderWithProviders } from '../../../../../internals/testing/redux-utils';
import Credits from '../index';
import 'utils/__tests__/__mocks__/matchMedia';

describe('<Credits />', () => {
it('should render a Credits', () => {
const { container } = render(
<IntlProvider locale={DEFAULT_LOCALE}>
<Credits />
</IntlProvider>,
);
const initialState = {
global: {
user: {
credits: [{ id: 1, amount: 5000, interestRate: 5.5, term: 12 }],
},
},
};

const { container } = renderWithProviders(<Credits />, { initialState });
expect(container.firstChild).toMatchSnapshot();
});

it('should render with empty credits array', () => {
const initialState = {
global: {
user: { credits: [] },
},
};

const { container } = renderWithProviders(<Credits />, { initialState });
expect(container.firstChild).toBeInTheDocument();
});

it('should render with multiple credits', () => {
const initialState = {
global: {
user: {
credits: [
{ id: 1, amount: 5000, interestRate: 5.5, term: 12 },
{ id: 2, amount: 10000, interestRate: 4.2, term: 24 },
],
},
},
};

const { container } = renderWithProviders(<Credits />, { initialState });
expect(container.firstChild).toBeInTheDocument();
});

it('should handle missing user data', () => {
const initialState = {
global: { user: null },
};

const { container } = renderWithProviders(<Credits />, { initialState });
expect(container.firstChild).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`<Deposits /> should render a Deposits 1`] = `
<div
class="ant-card Cardstyle__StyledCard-s807iu-0 egrUQF ant-card-bordered"
class="ant-card styles__StyledCard-sc-1tq6noh-0 iKqrYo ant-card-bordered"
darker="true"
excluded="true"
shadowed="true"
Expand All @@ -22,11 +22,11 @@ exports[`<Deposits /> should render a Deposits 1`] = `
class="ant-card-extra"
>
<button
class="ant-btn Buttonstyle__StyledButton-nh59mr-0 bcqyjQ ant-btn-link"
class="ant-btn styles__StyledButton-sc-1v6up7w-0 dbPSWh ant-btn-link"
type="button"
>
<div
class="Buttonstyle__StyledButtonContent-nh59mr-1 cBxojI"
class="styles__StyledButtonContent-sc-1v6up7w-1 hBxiOV"
>
<span
aria-label="bank"
Expand Down Expand Up @@ -61,7 +61,7 @@ exports[`<Deposits /> should render a Deposits 1`] = `
class="ant-card-body"
>
<div
class="Cardstyle__StyledCardContent-s807iu-1 fnMJaW"
class="styles__StyledCardContent-sc-1tq6noh-1 bOAQsz"
>
<span>
The deposits function is disabled.
Expand Down
Loading