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

Safe communication #761

Draft
wants to merge 18 commits into
base: dev
Choose a base branch
from
Draft
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
19 changes: 6 additions & 13 deletions __tests__/Components.unit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,48 +32,42 @@ describe('Component Components - test', () => {
<CurrencyAmount price={2.9826} amtZec={1.00098} style={{}} currency={CurrencyEnum.USDCurrency} privacy={true} />,
).toJSON();
expect(text.type).toBe('View');
expect(text.children[0].children[0].children[0].children[0]).toBe('$');
expect(text.children[0].children[0].children[1].children[0]).toBe(' -.--');
expect(text.children[0].children[0].children[0].children[0]).toBe('$ -.--');
});
test('CurrencyAmount - price undefined result $ -- USD', () => {
const text: any = render(<CurrencyAmount amtZec={1} style={{}} currency={CurrencyEnum.USDCurrency} />).toJSON();
expect(text.type).toBe('View');
expect(text.children[0].children[0].children[0].children[0]).toBe('$');
expect(text.children[0].children[0].children[1].children[0]).toBe(' -.--');
expect(text.children[0].children[0].children[0].children[0]).toBe('$ -.--');
});

test('CurrencyAmount - price 0 result $ -- USD', () => {
const text: any = render(
<CurrencyAmount price={0} amtZec={1} style={{}} currency={CurrencyEnum.USDCurrency} />,
).toJSON();
expect(text.type).toBe('View');
expect(text.children[0].children[0].children[0].children[0]).toBe('$');
expect(text.children[0].children[0].children[1].children[0]).toBe(' -.--');
expect(text.children[0].children[0].children[0].children[0]).toBe('$ -.--');
});

test('CurrencyAmount - amtZec undefined result $ -- USD', () => {
const text: any = render(<CurrencyAmount price={1} style={{}} currency={CurrencyEnum.USDCurrency} />).toJSON();
expect(text.type).toBe('View');
expect(text.children[0].children[0].children[0].children[0]).toBe('$');
expect(text.children[0].children[0].children[1].children[0]).toBe(' -.--');
expect(text.children[0].children[0].children[0].children[0]).toBe('$ -.--');
});

test('CurrencyAmount - price * amtZec really tiny result $ < 0.01 USD', () => {
const text: any = render(
<CurrencyAmount price={0.001} amtZec={1} style={{}} currency={CurrencyEnum.USDCurrency} />,
).toJSON();
expect(text.type).toBe('View');
expect(text.children[0].children[0].children[0].children[0]).toBe('$');
expect(text.children[0].children[0].children[1].children[0]).toBe(' < 0.01');
expect(text.children[0].children[0].children[0].children[0]).toBe('$ < 0.01');
});

test('CurrencyAmount - price=2.9826 and amtZec=1.00098 result $ 2.99 USD', () => {
const text: any = render(
<CurrencyAmount price={2.9826} amtZec={1.00098} style={{}} currency={CurrencyEnum.USDCurrency} />,
).toJSON();
expect(text.type).toBe('View');
expect(text.children[0].children[0].children[0].children[0]).toBe('$');
expect(text.children[0].children[0].children[1].children[0]).toBe(' 2.99');
expect(text.children[0].children[0].children[0].children[0]).toBe('$ 2.99');
});

test("CurrencyAmount - style={backgroundColor: 'red'} result same", () => {
Expand All @@ -87,7 +81,6 @@ describe('Component Components - test', () => {
).toJSON();
expect(text.type).toBe('View');
expect(text.children[0].children[0].children[0].props.style.backgroundColor).toBe('red');
expect(text.children[0].children[0].children[1].props.style.backgroundColor).toBe('red');
});

test('ZecAmount - High Privacy - amtZec -1.123456789 rounded up result -.---- ZEC', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/Info.es.unit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ describe('Component Info - test', () => {
<Info closeModal={onClose} setZecPrice={onSet} />
</ContextAppLoadedProvider>,
);
screen.getByText('33,33');
screen.getByText('$ 33,33');
});
});
2 changes: 1 addition & 1 deletion __tests__/Info.us.unit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ describe('Component Info - test', () => {
<Info closeModal={onClose} setZecPrice={onSet} />
</ContextAppLoadedProvider>,
);
screen.getByText('33.33');
screen.getByText('$ 33.33');
});
});
4 changes: 4 additions & 0 deletions __tests__/Messages.snapshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ describe('Component Messages - test', () => {
setSendPageState={onFunction}
setScrollToBottom={onFunction}
scrollToBottom={false}
setScrollToTop={onFunction}
scrollToTop={false}
/>
</ContextAppLoadedProvider>,
);
Expand All @@ -142,6 +144,8 @@ describe('Component Messages - test', () => {
setSendPageState={onFunction}
setScrollToBottom={onFunction}
scrollToBottom={false}
setScrollToTop={onFunction}
scrollToTop={false}
/>
</ContextAppLoadedProvider>,
);
Expand Down
3 changes: 1 addition & 2 deletions __tests__/Scanner.snapshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ describe('Component Scanner - test', () => {
//snapshot test
test('Scanner - snapshot', () => {
const onRead = jest.fn();
const doCancel = jest.fn();
const scanner = render(<Scanner onRead={onRead} doCancel={doCancel} title="title" button="button" />);
const scanner = render(<Scanner onRead={onRead} />);
expect(scanner.toJSON()).toMatchSnapshot();
});
});
Loading
Loading