Repository: hashicorp/vault
File: ui/tests/acceptance/vault-reporting/index-test.js (JavaScript)

Code before:
/**
 * Copyright (c) HashiCorp, Inc.
 * SPDX-License-Identifier: BUSL-1.1
 */

import { module, test } from 'qunit';
import { setupApplicationTest } from 'ember-qunit';
import { visit, currentURL, waitFor } from '@ember/test-helpers';
import { login } from 'vault/tests/helpers/auth/auth-helpers';
import { setupMirage } from 'ember-cli-mirage/test-support';

const mockedEmptyResponse = {
  data: {
    auth_methods: {},
    kvv1_secrets: 0,
    kvv2_secrets: 0,
    lease_count_quotas: {},
    leases_by_auth_method: {},
    replication_status: {},
    secret_engines: {},
  },
};

const mockedResponseWithData = {
  data: {
    auth_methods: { cats: 42 },
    kvv1_secrets: 60,
    kvv2_secrets: 40,
    lease_count_quotas: {
      global_lease_count_quota: { capacity: 420000, count: 210000, name: 'default' },
      total_lease_count_quotas: 1,
    },
    namespaces: 1,
    replication_status: {
      dr_primary: true,
      dr_state: 'enabled',
      pr_primary: false,
      pr_state: 'enabled',

Review comment (suggestion):
I believe Vault-reporting/Vault-usage is a enterprise-only feature? For enterprise features, we generally only want them to run on the enterprise binary (I realize your test is using mocks so we circumvent the actual need for this),but could you add `enterprise` the name. We use this key name to filter out only oss tests to run on the oss ci build. Ex: vault run test -f=!enterprise vs vault run test.
```suggestion
module('Acceptance | enterprise vault-reporting', function (hooks) {
```

Code after:
/**
 * Copyright (c) HashiCorp, Inc.
 * SPDX-License-Identifier: BUSL-1.1
 */

import { module, test } from 'qunit';
import { setupApplicationTest } from 'ember-qunit';
import { visit, currentURL, waitFor, click } from '@ember/test-helpers';
import { login } from 'vault/tests/helpers/auth/auth-helpers';
import { setupMirage } from 'ember-cli-mirage/test-support';
import { mockedResponseWithData, mockedEmptyResponse } from 'vault/tests/helpers/vault-usage/mocks';

module('Acceptance | enterprise vault-reporting', function (hooks) {
  setupApplicationTest(hooks);
  setupMirage(hooks);

  hooks.beforeEach(async function () {
    await login();
  });

  test('it visits the usage reporting dashboard and renders the header', async function (assert) {
    await visit('/vault/dashboard');
    await click('[data-test-sidebar-nav-link="Vault Usage"]');
    assert.strictEqual(currentURL(), '/vault/usage-reporting', 'navigates to usage reporting dashboard');
    assert.dom('.hds-page-header').includesText('Vault Usage', 'renders the "Vault Usage" header');
  });

  test('it renders the counters dashboard block with all expected counters', async function (assert) {
    this.server.get('sys/utilization-report', () => mockedResponseWithData);
    await visit('/vault/usage-reporting');
    await waitFor('[data-test-vault-reporting-dashboard-counters]');
    assert
      .dom('[data-test-vault-reporting-dashboard-counters]')
      .exists('renders the counters dashboard block');

    const expectedCounters = ['Child namespaces', 'KV secrets', 'Secrets sync', 'PKI roles'];

    expectedCounters.forEach((counterLabel) => {