ui: Add initial tests for peering searching/sorting (#14568)

* ui: Add initial tests for peering searching/sorting

* New lint
This commit is contained in:
John Cowen 2022-09-20 15:34:08 +01:00 committed by GitHub
parent ce4e8faa59
commit e174ec3dce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 35 additions and 15 deletions

View File

@ -4,7 +4,9 @@
@items={{@items}}
as |item index|>
<BlockSlot @name="header">
<p>
<p
data-test-peer={{item.Name}}
>
{{item.Name}}
</p>
</BlockSlot>

View File

@ -3,12 +3,16 @@ export const selectors = {
collection: {
$: '[data-test-list-row]',
peer: {
$: 'li'
$: 'li',
name: {
$: '[data-test-peer]'
}
},
}
};
export default (collection, isPresent) => () => {
export default (collection, isPresent, attribute) => () => {
return collection(`${selectors.$} ${selectors.collection.$}`, {
peer: isPresent(selectors.collection.peer.$),
name: attribute('data-test-peer', selectors.collection.peer.name.$),
});
};

View File

@ -17,10 +17,8 @@ export function serviceExternalSource(params, hash) {
'nomad',
'consul',
'aws',
'lambda'
].includes(
source
)
'lambda',
].includes(source)
) {
return `${prefix}${source}`;
}

View File

@ -124,9 +124,7 @@ export default function (config = {}, win = window, doc = document) {
? false
: operatorConfig.PeeringEnabled;
case 'CONSUL_HCP_ENABLED':
return typeof operatorConfig.HCPEnabled === 'undefined'
? false
: operatorConfig.HCPEnabled;
return typeof operatorConfig.HCPEnabled === 'undefined' ? false : operatorConfig.HCPEnabled;
case 'CONSUL_DATACENTER_LOCAL':
return operatorConfig.LocalDatacenter;
case 'CONSUL_DATACENTER_PRIMARY':

View File

@ -4,9 +4,9 @@ Feature: dc / peers / index: Peers List
And 1 datacenter model with the value "dc-1"
And 3 peer models from yaml
---
- Name: a-peer
- Name: b-peer
- Name: z-peer
- Name: b-peer
- Name: a-peer
---
When I visit the peers page for yaml
---
@ -14,6 +14,24 @@ Feature: dc / peers / index: Peers List
---
Then the url should be /dc-1/peers
And the title should be "Peers - Consul"
Scenario:
Scenario: Viewing peers
Then I see 3 peer models
Scenario: Sorting peers
When I click selected on the sort
# alpha
When I click options.2.button on the sort
Then I see name on the peers vertically like yaml
---
- a-peer
- b-peer
- z-peer
---
Scenario: Searching peers
Then I fill in with yaml
---
s: a-peer
---
And I see 1 peer model
And I see 1 peer model with the name "a-peer"

View File

@ -47,7 +47,7 @@ export default function (type) {
requests = ['/v1/namespaces', '/v1/namespace/'];
break;
case 'peer':
requests = ['/v1/peers', '/v1/peer/'];
requests = ['/v1/peerings', '/v1/peering/'];
break;
case 'topology':
requests = ['/v1/internal/ui/service-topology'];

View File

@ -111,7 +111,7 @@ const consulNspaceList = consulNspaceListFactory(
text,
morePopoverMenu
);
const consulPeerList = consulPeerListFactory(collection, isPresent);
const consulPeerList = consulPeerListFactory(collection, isPresent, attribute);
const consulKvList = consulKvListFactory(collection, clickable, attribute, deletable);
const consulTokenList = consulTokenListFactory(
collection,