feat(tool): text statistics

This commit is contained in:
Corentin Thomasset 2022-04-14 01:06:06 +02:00
parent 2f49631ff7
commit 0a7c3252e3
No known key found for this signature in database
GPG key ID: DBD997E935996158
7 changed files with 67 additions and 1 deletions

View file

@ -0,0 +1,14 @@
import { expect, describe, it } from 'vitest';
import { getStringSizeInBytes } from './text-statistics.service';
describe('text-statistics', () => {
describe('getStringSizeInBytes', () => {
it('should return the size of a string in bytes', () => {
expect(getStringSizeInBytes('')).toEqual(0);
expect(getStringSizeInBytes('a')).toEqual(1);
expect(getStringSizeInBytes('aa')).toEqual(2);
expect(getStringSizeInBytes('😀')).toEqual(4);
expect(getStringSizeInBytes('aaaaaaaaaa')).toEqual(10);
});
});
});