* creating overview page and menu * styling the home page * adjusting breadcrumb * renaming isnt working * renaming isnt working * renaming isnt working * fixing import * fixing scroll when resize window * fixing eslint errors * prepending links * adding target option * refactoring * adding dark mode support * fixing prettier format * fixing i18n * reverting some unnecessary changes * addressing PR comments * fixing functional tests * ordering observability menu * fixing tests * addressing PR comments * fixing scroll * addressing pr comments * addressing pr comments * creating overview page * mocking data * mocking data * refactoring * crearting apm chart * adding overview page * adding metric charts * adding charts * changing mock data location * adding mock registry * adding date picker * adding route validation * adding io-ts * adding io-ts * adding io-ts support * fixing imports and mock data * adding app folder * creating a section for each plugin * adding stats * adding domain min max * refactoring xcoordinaters * fixing route * adding bucket size * adding group property on logs * adding home page * dont break page if location state is undefined * each component fetches its own data * Refactoring * adding loading indicator to chart * fixing uptime chart * adding brush functionality to charts * fixing refresh button and auto refresh function * adding horizontal line to accordion section * adding emptySection to dashboard page * adding add data button * adding resources section * removing margins from horizontal rule * changing min interval to 60s * fixing empty section * removing unnecessary code * adding unit tests * fixing imports * adding initial story book for observability * removeing uptime mock data * fixing xDomain to show correct data on x-axis * fixing empty state alignment * adding story book and other improvements * adding news component * adding support to custom colors on EuiProgress and EuiStats * removing infra mock data * adding error message when api throwns an error * adding alert section * Adding alerts * adding alert api call * addressing PR comments * adding storybook * adding feedback button * addressing PR comments * chamging plugins return data * fixing kibana app navigation * fixing unit test * fixing ts issues * addressing PR comments * using lodash truncate * adding comment * updating public documentation * fixing alerts request * fixing unit test * fixing unit test * aligin beta badge to the center * adding moment duration to get the units as seconds * addressing PR comments * addressing PR comments
50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License;
|
|
* you may not use this file except in compliance with the Elastic License.
|
|
*/
|
|
import { formatStatValue } from './format_stat_value';
|
|
import { Stat } from '../typings';
|
|
|
|
describe('formatStatValue', () => {
|
|
it('formats value as number', () => {
|
|
const stat = {
|
|
type: 'number',
|
|
label: 'numeral stat',
|
|
value: 1000,
|
|
} as Stat;
|
|
expect(formatStatValue(stat)).toEqual('1k');
|
|
});
|
|
it('formats value as bytes', () => {
|
|
expect(
|
|
formatStatValue({
|
|
type: 'bytesPerSecond',
|
|
label: 'bytes stat',
|
|
value: 1,
|
|
} as Stat)
|
|
).toEqual('1.0B/s');
|
|
expect(
|
|
formatStatValue({
|
|
type: 'bytesPerSecond',
|
|
label: 'bytes stat',
|
|
value: 1048576,
|
|
} as Stat)
|
|
).toEqual('1.0MB/s');
|
|
expect(
|
|
formatStatValue({
|
|
type: 'bytesPerSecond',
|
|
label: 'bytes stat',
|
|
value: 1073741824,
|
|
} as Stat)
|
|
).toEqual('1.0GB/s');
|
|
});
|
|
it('formats value as percent', () => {
|
|
const stat = {
|
|
type: 'percent',
|
|
label: 'percent stat',
|
|
value: 0.841,
|
|
} as Stat;
|
|
expect(formatStatValue(stat)).toEqual('84.1%');
|
|
});
|
|
});
|