Repository: hashicorp/vault
File: ui/tests/integration/components/sidebar/nav/cluster-test.js (JavaScript)

Code before:
        'nested-interactive': { enabled: false },
      },
    });
  });

  test('it should render nav headings', async function (assert) {
    const headings = ['Vault', 'Monitoring', 'Settings'];
    stubFeaturesAndPermissions(this.owner, true, true);
    await renderComponent();

    assert
      .dom('[data-test-sidebar-nav-heading]')
      .exists({ count: headings.length }, 'Correct number of headings render');
    headings.forEach((heading) => {
      assert
        .dom(`[data-test-sidebar-nav-heading="${heading}"]`)
        .hasText(heading, `${heading} heading renders`);
    });
  });

  test('it should hide links and headings user does not have access too', async function (assert) {
    await renderComponent();

    assert
      .dom('[data-test-sidebar-nav-link]')
      .exists({ count: 2 }, 'Nav links are hidden other than secrets and dashboard');
    assert
      .dom('[data-test-sidebar-nav-heading]')
      .exists({ count: 1 }, 'Headings are hidden other than Vault');
  });

  test('it should render nav links', async function (assert) {
    const links = [
      'Dashboard',
      'Secrets Engines',
      'Secrets Sync',
      'Access',
      'Policies',
      'Tools',
      'Replication',
      'Raft Storage',
      'Client Count',
      'Vault Usage',
      'License',
      'Seal Vault',
      'Custom Messages',
      'UI Login Settings',
    ];
    stubFeaturesAndPermissions(this.owner, true, true);
    await renderComponent();


Review comment (security):
maybe add a todo since this will change, we'll want to gate these in the has-permission helper? Or we could update the [helper api path map](https://github.com/hashicorp/vault/blob/main/ui/app/services/permissions.js#L15) with the relevant routes and wrap the sidenav link now - up to you :) 


Code after:
        'nested-interactive': { enabled: false },
      },
    });
  });

  test('it should render nav headings', async function (assert) {
    const headings = ['Vault', 'Monitoring', 'Settings'];
    stubFeaturesAndPermissions(this.owner, true, true);
    await renderComponent();

    assert
      .dom('[data-test-sidebar-nav-heading]')
      .exists({ count: headings.length }, 'Correct number of headings render');
    headings.forEach((heading) => {
      assert
        .dom(`[data-test-sidebar-nav-heading="${heading}"]`)
        .hasText(heading, `${heading} heading renders`);
    });
  });

  test('it should hide links and headings user does not have access to', async function (assert) {
    await renderComponent();

    assert
      .dom('[data-test-sidebar-nav-link]')
      .exists({ count: 3 }, 'Nav links are hidden other than secrets, recovery and dashboard');
    assert
      .dom('[data-test-sidebar-nav-heading]')
      .exists({ count: 1 }, 'Headings are hidden other than Vault');
  });

  test('it should render nav links', async function (assert) {
    const links = [
      'Dashboard',
      'Secrets Engines',
      'Secrets Sync',
      'Secrets Recovery',
      'Access',
      'Policies',
      'Tools',
      'Replication',
      'Raft Storage',
      'Client Count',
      'Vault Usage',
      'License',
      'Seal Vault',
      'Custom Messages',
      'UI Login Settings',
    ];
    stubFeaturesAndPermissions(this.owner, true, true);
    await renderComponent();