aboutsummaryrefslogtreecommitdiff
path: root/src/tools/text-statistics/text-statistics.service.test.ts
blob: 5260683400c330bce01a3fcc11c76a2dd8f163b4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
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);
    });
  });
});