mirror of
https://github.com/trezor/trezor-wallet
synced 2025-03-28 14:05:44 +00:00
Added more unit tests
This commit is contained in:
parent
8ab0ae79a8
commit
6a29da8fd8
@ -1,12 +1,16 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`device utils get status 1`] = `"Status unknown"`;
|
exports[`device utils get status 1`] = `"disconnected"`;
|
||||||
|
|
||||||
exports[`device utils get status 2`] = `"Status unknown"`;
|
exports[`device utils get status 2`] = `"unavailable"`;
|
||||||
|
|
||||||
exports[`device utils get status 3`] = `"Status unknown"`;
|
exports[`device utils get status 3`] = `"unavailable"`;
|
||||||
|
|
||||||
exports[`device utils get status 4`] = `"Status unknown"`;
|
exports[`device utils get status 4`] = `"connected"`;
|
||||||
|
|
||||||
|
exports[`device utils get status 5`] = `"unacquired"`;
|
||||||
|
|
||||||
|
exports[`device utils get status 6`] = `"used-in-other-window"`;
|
||||||
|
|
||||||
exports[`device utils get status color 1`] = `"#494949"`;
|
exports[`device utils get status color 1`] = `"#494949"`;
|
||||||
|
|
||||||
@ -39,3 +43,15 @@ exports[`device utils get status name 6`] = `"Used in other window"`;
|
|||||||
exports[`device utils get status name 7`] = `"Disconnected"`;
|
exports[`device utils get status name 7`] = `"Disconnected"`;
|
||||||
|
|
||||||
exports[`device utils get status name 8`] = `"Unavailable"`;
|
exports[`device utils get status name 8`] = `"Unavailable"`;
|
||||||
|
|
||||||
|
exports[`device utils get version 1`] = `"1"`;
|
||||||
|
|
||||||
|
exports[`device utils get version 2`] = `"1"`;
|
||||||
|
|
||||||
|
exports[`device utils get version 3`] = `"1"`;
|
||||||
|
|
||||||
|
exports[`device utils get version 4`] = `"1"`;
|
||||||
|
|
||||||
|
exports[`device utils get version 5`] = `"1"`;
|
||||||
|
|
||||||
|
exports[`device utils get version 6`] = `"T"`;
|
||||||
|
@ -4,19 +4,52 @@ describe('device utils', () => {
|
|||||||
it('get status', () => {
|
it('get status', () => {
|
||||||
const deviceMock = [
|
const deviceMock = [
|
||||||
{
|
{
|
||||||
device: {
|
connected: false,
|
||||||
connected: false,
|
},
|
||||||
type: 'acquired',
|
{
|
||||||
status: 'occupied',
|
connected: true,
|
||||||
},
|
available: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
connected: true,
|
||||||
|
available: false,
|
||||||
|
type: null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
connected: true,
|
||||||
|
available: true,
|
||||||
|
type: 'acquired',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
connected: true,
|
||||||
|
available: true,
|
||||||
|
type: 'unacquired',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
connected: true,
|
||||||
|
available: true,
|
||||||
|
type: 'acquired',
|
||||||
|
status: 'occupied',
|
||||||
},
|
},
|
||||||
{ device: { connected: true } },
|
|
||||||
{ device: { available: false } },
|
|
||||||
{ device: { available: true } },
|
|
||||||
];
|
];
|
||||||
|
|
||||||
deviceMock.forEach((device) => {
|
deviceMock.forEach((device) => {
|
||||||
expect(dUtils.getStatusName(device)).toMatchSnapshot();
|
expect(dUtils.getStatus(device)).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('get version', () => {
|
||||||
|
const deviceMock = [
|
||||||
|
{ },
|
||||||
|
{ features: {} },
|
||||||
|
{ features: { major_version: null } },
|
||||||
|
{ features: { major_version: 0 } },
|
||||||
|
{ features: { major_version: 1 } },
|
||||||
|
{ features: { major_version: 2 } },
|
||||||
|
];
|
||||||
|
|
||||||
|
deviceMock.forEach((device) => {
|
||||||
|
expect(dUtils.getVersion(device)).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user