mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 02:00:43 +00:00
25 lines
677 B
JavaScript
25 lines
677 B
JavaScript
jest.dontMock('../string-utils');
|
|
|
|
describe('StringUtils', () => {
|
|
const StringUtils = require('../string-utils');
|
|
|
|
describe('formatMetric', () => {
|
|
const formatMetric = StringUtils.formatMetric;
|
|
|
|
it('it should render 0', () => {
|
|
expect(formatMetric(0)).toBe('0.00');
|
|
});
|
|
});
|
|
|
|
describe('longestCommonPrefix', () => {
|
|
const fun = StringUtils.longestCommonPrefix;
|
|
|
|
it('it should return the longest common prefix', () => {
|
|
expect(fun(['interspecies', 'interstellar'])).toBe('inters');
|
|
expect(fun(['space', 'space'])).toBe('space');
|
|
expect(fun([''])).toBe('');
|
|
expect(fun(['prefix', 'suffix'])).toBe('');
|
|
});
|
|
});
|
|
});
|