diff --git a/package.json b/package.json index bcf737c3..e35c2b19 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "lint": "run-s lint:*", "lint:js": "eslint ./src/js ./webpack", "lint:css": "stylelint './src/js/**/*.js'", - "test:*": "run-s test:*", + "test": "run-s test:*", "test:unit": "jest", "test-unit:watch": "jest -o --watchAll" }, diff --git a/src/js/utils/__tests__/__snapshots__/device.test.js.snap b/src/js/utils/__tests__/__snapshots__/device.test.js.snap new file mode 100644 index 00000000..a8cc7ea8 --- /dev/null +++ b/src/js/utils/__tests__/__snapshots__/device.test.js.snap @@ -0,0 +1,41 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`device utils get status 1`] = `"Status unknown"`; + +exports[`device utils get status 2`] = `"Status unknown"`; + +exports[`device utils get status 3`] = `"Status unknown"`; + +exports[`device utils get status 4`] = `"Status unknown"`; + +exports[`device utils get status color 1`] = `"#494949"`; + +exports[`device utils get status color 2`] = `"#494949"`; + +exports[`device utils get status color 3`] = `"#494949"`; + +exports[`device utils get status color 4`] = `"#EB8A00"`; + +exports[`device utils get status color 5`] = `"#01B757"`; + +exports[`device utils get status color 6`] = `"#EB8A00"`; + +exports[`device utils get status color 7`] = `"#ED1212"`; + +exports[`device utils get status color 8`] = `"#ED1212"`; + +exports[`device utils get status name 1`] = `"Status unknown"`; + +exports[`device utils get status name 2`] = `"Status unknown"`; + +exports[`device utils get status name 3`] = `"Status unknown"`; + +exports[`device utils get status name 4`] = `"Used in other window"`; + +exports[`device utils get status name 5`] = `"Connected"`; + +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 8`] = `"Unavailable"`; diff --git a/src/js/utils/__tests__/device.test.js b/src/js/utils/__tests__/device.test.js new file mode 100644 index 00000000..4d47d1ee --- /dev/null +++ b/src/js/utils/__tests__/device.test.js @@ -0,0 +1,56 @@ +import * as dUtils from 'utils/device'; + +describe('device utils', () => { + it('get status', () => { + const deviceMock = [ + { + device: { + connected: false, + type: 'acquired', + status: 'occupied', + }, + }, + { device: { connected: true } }, + { device: { available: false } }, + { device: { available: true } }, + ]; + + deviceMock.forEach((device) => { + expect(dUtils.getStatusName(device)).toMatchSnapshot(); + }); + }); + + it('get status color', () => { + const entry = [ + 0, + null, + 'sdsdsdsd', + 'used-in-other-window', + 'connected', + 'unacquired', + 'disconnected', + 'unavailable', + ]; + + entry.forEach((status) => { + expect(dUtils.getStatusColor(status)).toMatchSnapshot(); + }); + }); + + it('get status name', () => { + const entry = [ + 0, + null, + 'sdsdsdsd', + 'used-in-other-window', + 'connected', + 'unacquired', + 'disconnected', + 'unavailable', + ]; + + entry.forEach((status) => { + expect(dUtils.getStatusName(status)).toMatchSnapshot(); + }); + }); +}); diff --git a/src/js/views/Wallet/index.js b/src/js/views/Wallet/index.js index 1d79de71..fb72d426 100644 --- a/src/js/views/Wallet/index.js +++ b/src/js/views/Wallet/index.js @@ -37,8 +37,6 @@ const AppWrapper = styled.div` background: ${colors.BACKGROUND}; &.resized { - // to make sure that unpacked coin menu will not overflow main container - // 512 dropdown height + 50 header + 30 margin + 64 topnav height min-height: 680px; } `;