-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
14490b4
commit 0680ab0
Showing
3 changed files
with
50 additions
and
61 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
packages/components/src/components/money/__tests__/money.spec.tsx
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import Money from '../money'; | ||
|
||
describe('Money', () => { | ||
it('should have the "className" when passed in', () => { | ||
render(<Money className='test-class' />); | ||
expect(screen.getByTestId('dt_span')).toHaveClass('test-class'); | ||
}); | ||
|
||
it('should return correct text based on the props when "amount" is > 0 and "has_sign" is "true"', () => { | ||
render(<Money has_sign amount={+10} />); | ||
expect(screen.getByText('+')).toBeInTheDocument(); | ||
expect(screen.getByText('10.00')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should return correct text based on the props when "amount" is < 0 and "has_sign" is "true"', () => { | ||
render(<Money has_sign amount={-10} />); | ||
expect(screen.getByText('-')).toBeInTheDocument(); | ||
expect(screen.getByText('10.00')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should return correct text based on the props when "amount" is 0 and "has_sign" is "true"', () => { | ||
render(<Money has_sign amount={0} />); | ||
expect(screen.getByText('0.00')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should return correct text based on the props when "amount" is > 0 and "has_sign" is "true" and "should_format" is "false")', () => { | ||
render(<Money has_sign amount={+10} should_format={false} />); | ||
expect(screen.getByText('+')).toBeInTheDocument(); | ||
expect(screen.getByText('10')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should return correct text based on the props when "amount" is < 0 and "has_sign" is "true" and "should_format" is "false"', () => { | ||
render(<Money has_sign amount={-10.5} should_format={false} />); | ||
expect(screen.getByText('-')).toBeInTheDocument(); | ||
expect(screen.getByText('10.5')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should return correct text based on the props when "amount" is 0 and "has_sign" is "true" and "should_format" is "false"', () => { | ||
render(<Money has_sign should_format={false} amount={0} />); | ||
expect(screen.getByText('0')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should show the currency when "show_currency" passed', () => { | ||
render(<Money amount={0} show_currency />); | ||
expect(screen.getByText('0.00 USD')).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains 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
60 changes: 0 additions & 60 deletions
60
packages/trader/src/App/Components/Elements/__tests__/money.spec.tsx
This file was deleted.
Oops, something went wrong.