-
Notifications
You must be signed in to change notification settings - Fork 179
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
feat(app): Remove 'opentrons-' prefix in robot displayNames #2459
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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 |
---|---|---|
@@ -1,8 +1,15 @@ | ||
// discovery selectors tests | ||
import * as discovery from '..' | ||
|
||
const makeFullyUp = (name, ip, status = null, connected = null) => ({ | ||
const makeFullyUp = ( | ||
name, | ||
displayName, | ||
ip, | ||
status = null, | ||
connected = null | ||
) => ({ | ||
name, | ||
displayName, | ||
ip, | ||
local: false, | ||
ok: true, | ||
|
@@ -14,8 +21,15 @@ const makeFullyUp = (name, ip, status = null, connected = null) => ({ | |
connected, | ||
}) | ||
|
||
const makeConnectable = (name, ip, status = null, connected = null) => ({ | ||
const makeConnectable = ( | ||
name, | ||
displayName, | ||
ip, | ||
status = null, | ||
connected = null | ||
) => ({ | ||
name, | ||
displayName, | ||
ip, | ||
local: false, | ||
ok: true, | ||
|
@@ -25,8 +39,9 @@ const makeConnectable = (name, ip, status = null, connected = null) => ({ | |
connected, | ||
}) | ||
|
||
const makeAdvertising = (name, ip, status = null) => ({ | ||
const makeAdvertising = (name, displayName, ip, status = null) => ({ | ||
name, | ||
displayName, | ||
ip, | ||
local: false, | ||
ok: false, | ||
|
@@ -35,8 +50,9 @@ const makeAdvertising = (name, ip, status = null) => ({ | |
status, | ||
}) | ||
|
||
const makeServerUp = (name, ip, advertising, status = null) => ({ | ||
const makeServerUp = (name, displayName, ip, advertising, status = null) => ({ | ||
name, | ||
displayName, | ||
ip, | ||
advertising, | ||
local: false, | ||
|
@@ -46,8 +62,9 @@ const makeServerUp = (name, ip, advertising, status = null) => ({ | |
status, | ||
}) | ||
|
||
const makeUnreachable = (name, ip, status = null) => ({ | ||
const makeUnreachable = (name, displayName, ip, status = null) => ({ | ||
name, | ||
displayName, | ||
ip, | ||
local: false, | ||
ok: false, | ||
|
@@ -76,15 +93,15 @@ describe('discovery selectors', () => { | |
state: { | ||
discovery: { | ||
robotsByName: { | ||
foo: [makeConnectable('foo', '10.0.0.1')], | ||
bar: [makeFullyUp('bar', '10.0.0.2')], | ||
foo: [makeConnectable('foo', 'foo', '10.0.0.1')], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Putting display name in the state means our selector isn't necessarily being tested, because the selector doesn't have to add anything to the object for the test to pass |
||
bar: [makeFullyUp('bar', 'bar', '10.0.0.2')], | ||
}, | ||
}, | ||
robot: {connection: {connectedTo: 'bar'}}, | ||
}, | ||
expected: [ | ||
makeConnectable('foo', '10.0.0.1', 'connectable', false), | ||
makeFullyUp('bar', '10.0.0.2', 'connectable', true), | ||
makeConnectable('foo', 'foo', '10.0.0.1', 'connectable', false), | ||
makeFullyUp('bar', 'bar', '10.0.0.2', 'connectable', true), | ||
], | ||
}, | ||
{ | ||
|
@@ -94,31 +111,33 @@ describe('discovery selectors', () => { | |
discovery: { | ||
robotsByName: { | ||
foo: [ | ||
makeConnectable('foo', '10.0.0.1'), | ||
makeConnectable('foo', '10.0.0.2'), | ||
makeServerUp('foo', '10.0.0.3', false), | ||
makeAdvertising('foo', '10.0.0.4', false), | ||
makeConnectable('foo', 'foo', '10.0.0.1'), | ||
makeConnectable('foo', 'foo', '10.0.0.2'), | ||
makeServerUp('foo', 'foo', '10.0.0.3', false), | ||
makeAdvertising('foo', 'foo', '10.0.0.4', false), | ||
], | ||
}, | ||
}, | ||
robot: {connection: {connectedTo: 'foo'}}, | ||
}, | ||
expected: [makeConnectable('foo', '10.0.0.1', 'connectable', true)], | ||
expected: [ | ||
makeConnectable('foo', 'foo', '10.0.0.1', 'connectable', true), | ||
], | ||
}, | ||
{ | ||
name: 'getReachableRobots grabs robots with serverUp or advertising', | ||
selector: discovery.getReachableRobots, | ||
state: { | ||
discovery: { | ||
robotsByName: { | ||
foo: [makeServerUp('foo', '10.0.0.1', false)], | ||
bar: [makeAdvertising('bar', '10.0.0.2')], | ||
foo: [makeServerUp('foo', 'foo', '10.0.0.1', false)], | ||
bar: [makeAdvertising('bar', 'bar', '10.0.0.2')], | ||
}, | ||
}, | ||
}, | ||
expected: [ | ||
makeServerUp('foo', '10.0.0.1', false, 'reachable'), | ||
makeAdvertising('bar', '10.0.0.2', 'reachable'), | ||
makeServerUp('foo', 'foo', '10.0.0.1', false, 'reachable'), | ||
makeAdvertising('bar', 'bar', '10.0.0.2', 'reachable'), | ||
], | ||
}, | ||
{ | ||
|
@@ -128,14 +147,14 @@ describe('discovery selectors', () => { | |
discovery: { | ||
robotsByName: { | ||
foo: [ | ||
makeServerUp('foo', '10.0.0.1', true), | ||
makeServerUp('foo', '10.0.0.1', false), | ||
makeAdvertising('foo', '10.0.0.2'), | ||
makeServerUp('foo', 'foo', '10.0.0.1', true), | ||
makeServerUp('foo', 'foo', '10.0.0.1', false), | ||
makeAdvertising('foo', 'foo', '10.0.0.2'), | ||
], | ||
}, | ||
}, | ||
}, | ||
expected: [makeServerUp('foo', '10.0.0.1', true, 'reachable')], | ||
expected: [makeServerUp('foo', 'foo', '10.0.0.1', true, 'reachable')], | ||
}, | ||
{ | ||
name: 'getReachableRobots does not grab connectable robots', | ||
|
@@ -144,18 +163,18 @@ describe('discovery selectors', () => { | |
discovery: { | ||
robotsByName: { | ||
foo: [ | ||
makeConnectable('foo', '10.0.0.1'), | ||
makeServerUp('foo', '10.0.0.2', true), | ||
makeConnectable('foo', 'foo', '10.0.0.1'), | ||
makeServerUp('foo', 'foo', '10.0.0.2', true), | ||
], | ||
bar: [ | ||
makeConnectable('bar', '10.0.0.3'), | ||
makeServerUp('bar', '10.0.0.4', false), | ||
makeConnectable('bar', 'bar', '10.0.0.3'), | ||
makeServerUp('bar', 'bar', '10.0.0.4', false), | ||
], | ||
baz: [ | ||
makeConnectable('baz', '10.0.0.5'), | ||
makeAdvertising('baz', '10.0.0.6'), | ||
makeConnectable('baz', 'baz', '10.0.0.5'), | ||
makeAdvertising('baz', 'baz', '10.0.0.6'), | ||
], | ||
qux: [makeFullyUp('qux', '10.0.0.7')], | ||
qux: [makeFullyUp('qux', 'baz', '10.0.0.7')], | ||
}, | ||
}, | ||
}, | ||
|
@@ -165,9 +184,13 @@ describe('discovery selectors', () => { | |
name: 'getUnreachableRobots grabs robots with no ip', | ||
selector: discovery.getUnreachableRobots, | ||
state: { | ||
discovery: {robotsByName: {foo: [{name: 'foo', ip: null}]}}, | ||
discovery: { | ||
robotsByName: {foo: [{name: 'foo', displayName: 'foo', ip: null}]}, | ||
}, | ||
}, | ||
expected: [{name: 'foo', ip: null, status: 'unreachable'}], | ||
expected: [ | ||
{name: 'foo', displayName: 'foo', ip: null, status: 'unreachable'}, | ||
], | ||
}, | ||
{ | ||
name: 'getUnreachableRobots grabs robots with IP but no responses', | ||
|
@@ -176,13 +199,13 @@ describe('discovery selectors', () => { | |
discovery: { | ||
robotsByName: { | ||
foo: [ | ||
makeUnreachable('foo', '10.0.0.1'), | ||
makeUnreachable('foo', '10.0.0.2'), | ||
makeUnreachable('foo', 'foo', '10.0.0.1'), | ||
makeUnreachable('foo', 'foo', '10.0.0.2'), | ||
], | ||
}, | ||
}, | ||
}, | ||
expected: [makeUnreachable('foo', '10.0.0.1', 'unreachable')], | ||
expected: [makeUnreachable('foo', 'foo', '10.0.0.1', 'unreachable')], | ||
}, | ||
{ | ||
name: "getUnreachableRobots won't grab connectable/reachable robots", | ||
|
@@ -191,18 +214,18 @@ describe('discovery selectors', () => { | |
discovery: { | ||
robotsByName: { | ||
foo: [ | ||
makeServerUp('foo', '10.0.0.1', true), | ||
makeUnreachable('foo', '10.0.0.2'), | ||
makeServerUp('foo', 'foo', '10.0.0.1', true), | ||
makeUnreachable('foo', 'foo', '10.0.0.2'), | ||
], | ||
bar: [ | ||
makeServerUp('bar', '10.0.0.3', false), | ||
makeServerUp('bar', 'bar', '10.0.0.3', false), | ||
makeUnreachable('bar', '10.0.0.4'), | ||
], | ||
baz: [ | ||
makeAdvertising('bar', '10.0.0.5'), | ||
makeUnreachable('baz', '10.0.0.6'), | ||
makeAdvertising('bar', 'bar', '10.0.0.5'), | ||
makeUnreachable('baz', 'baz', '10.0.0.6'), | ||
], | ||
qux: [makeConnectable('qux', '10.0.0.7')], | ||
qux: [makeConnectable('qux', 'qux', '10.0.0.7')], | ||
}, | ||
}, | ||
}, | ||
|
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
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
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I wasn't thinking when you showed this to me earlier. These helpers pull double duty as both state inputs and selector expected outputs. Since
displayName
is a selector output, we should tack it on at the end and default it tonull
likestatus
andconnected