Skip to content

Commit

Permalink
Fix UI Capabilities tests
Browse files Browse the repository at this point in the history
The enterpriseSearch plugin does not have a required dependency on
the security plugin in the 7.17 branch, so our bacported
assertions for these tests needed to change accordingly.
  • Loading branch information
Joe Portner committed Apr 11, 2022
1 parent a8397f9 commit 52725aa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 26 deletions.
15 changes: 2 additions & 13 deletions x-pack/test/ui_capabilities/spaces_only/tests/catalogue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ export default function catalogueTests({ getService }: FtrProviderContext) {
'watcher',
];

const uiCapabilitiesExceptions = [
// enterprise_search plugin is loaded but disabled because security isn't enabled in ES. That means the following 3 capabilities are disabled
'enterpriseSearch',
'appSearch',
'workplaceSearch',
];

describe('catalogue', () => {
SpaceScenarios.forEach((scenario) => {
it(`${scenario.name}`, async () => {
Expand All @@ -40,10 +33,7 @@ export default function catalogueTests({ getService }: FtrProviderContext) {
expect(uiCapabilities.success).to.be(true);
expect(uiCapabilities.value).to.have.property('catalogue');
// everything is enabled
const expected = mapValues(
uiCapabilities.value!.catalogue,
(enabled, catalogueId) => !uiCapabilitiesExceptions.includes(catalogueId)
);
const expected = mapValues(uiCapabilities.value!.catalogue, () => true);
expect(uiCapabilities.value!.catalogue).to.eql(expected);
break;
}
Expand All @@ -65,8 +55,7 @@ export default function catalogueTests({ getService }: FtrProviderContext) {
// only foo is disabled
const expected = mapValues(
uiCapabilities.value!.catalogue,
(enabled, catalogueId) =>
!uiCapabilitiesExceptions.includes(catalogueId) && catalogueId !== 'foo'
(enabled, catalogueId) => catalogueId !== 'foo'
);
expect(uiCapabilities.value!.catalogue).to.eql(expected);
break;
Expand Down
15 changes: 2 additions & 13 deletions x-pack/test/ui_capabilities/spaces_only/tests/nav_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ export default function navLinksTests({ getService }: FtrProviderContext) {
const uiCapabilitiesService: UICapabilitiesService = getService('uiCapabilities');
const featuresService: FeaturesService = getService('features');

const uiCapabilitiesExceptions = [
// enterprise_search plugin is loaded but disabled because security isn't enabled in ES. That means the following 3 capabilities are disabled
'enterpriseSearch',
'appSearch',
'workplaceSearch',
];

describe('navLinks', () => {
let navLinksBuilder: NavLinksBuilder;
before(async () => {
Expand All @@ -37,9 +30,7 @@ export default function navLinksTests({ getService }: FtrProviderContext) {
case 'everything_space':
expect(uiCapabilities.success).to.be(true);
expect(uiCapabilities.value).to.have.property('navLinks');
expect(uiCapabilities.value!.navLinks).to.eql(
navLinksBuilder.except(...uiCapabilitiesExceptions)
);
expect(uiCapabilities.value!.navLinks).to.eql(navLinksBuilder.all());
break;
case 'nothing_space':
expect(uiCapabilities.success).to.be(true);
Expand All @@ -49,9 +40,7 @@ export default function navLinksTests({ getService }: FtrProviderContext) {
case 'foo_disabled_space':
expect(uiCapabilities.success).to.be(true);
expect(uiCapabilities.value).to.have.property('navLinks');
expect(uiCapabilities.value!.navLinks).to.eql(
navLinksBuilder.except('foo', ...uiCapabilitiesExceptions)
);
expect(uiCapabilities.value!.navLinks).to.eql(navLinksBuilder.except('foo'));
break;
default:
throw new UnreachableError(scenario);
Expand Down

0 comments on commit 52725aa

Please sign in to comment.