mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 11:38:02 +00:00
UI: Add charts to ACME client count tab (#26385)
* use model returned by route model hook for ts declaration * remove hasActivity helper * refactor mirage so namespace totals are summed from monthly data * add charts to acme tab * add controller, update counts test * add test for acme page * selector cleanup * update empty state handling for cc charts * cleanup conditional logic * add acme acceptance tests for filtering * wrap up util updates * finish acceptance tests * update usage stats * wrap up number updates from latest stubbed response
This commit is contained in:
@@ -12,6 +12,7 @@ import sinon from 'sinon';
|
||||
import { LICENSE_START, STATIC_NOW } from 'vault/mirage/handlers/clients';
|
||||
import timestamp from 'core/utils/timestamp';
|
||||
import { ACTIVITY_RESPONSE_STUB } from 'vault/tests/helpers/clients/client-count-helpers';
|
||||
import { formatNumber } from 'core/helpers/format-number';
|
||||
|
||||
module('Integration | Component | dashboard/client-count-card', function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
@@ -33,6 +34,8 @@ module('Integration | Component | dashboard/client-count-card', function (hooks)
|
||||
|
||||
test('it should display client count information', async function (assert) {
|
||||
assert.expect(9);
|
||||
const { months, total } = ACTIVITY_RESPONSE_STUB;
|
||||
const [latestMonth] = months.slice(-1);
|
||||
this.server.get('sys/internal/counters/activity', () => {
|
||||
// this assertion should be hit twice, once initially and then again clicking 'refresh'
|
||||
assert.true(true, 'makes request to sys/internal/counters/activity');
|
||||
@@ -48,13 +51,16 @@ module('Integration | Component | dashboard/client-count-card', function (hooks)
|
||||
assert
|
||||
.dom('[data-test-stat-text="total-clients"] .stat-text')
|
||||
.hasText('The number of clients in this billing period (Jul 2023 - Jan 2024).');
|
||||
assert.dom('[data-test-stat-text="total-clients"] .stat-value').hasText('7,805');
|
||||
assert
|
||||
.dom('[data-test-stat-text="total-clients"] .stat-value')
|
||||
.hasText(`${formatNumber([total.clients])}`);
|
||||
assert.dom('[data-test-stat-text="new-clients"] .stat-label').hasText('New');
|
||||
assert
|
||||
.dom('[data-test-stat-text="new-clients"] .stat-text')
|
||||
.hasText('The number of clients new to Vault in the current month.');
|
||||
assert.dom('[data-test-stat-text="new-clients"] .stat-value').hasText('336');
|
||||
|
||||
assert
|
||||
.dom('[data-test-stat-text="new-clients"] .stat-value')
|
||||
.hasText(`${formatNumber([latestMonth.new_clients.counts.clients])}`);
|
||||
// fires second request to /activity
|
||||
await click('[data-test-refresh]');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user