2
0

to-array-from-csv.test.js 740 B

123456789101112131415161718192021222324252627282930
  1. import { toArrayFromCsv } from '~/utils/to-array-from-csv';
  2. describe('To array from csv', () => {
  3. test('case 1', () => {
  4. const result = toArrayFromCsv('dev,general');
  5. expect(result).toStrictEqual(['dev', 'general']);
  6. });
  7. test('case 2', () => {
  8. const result = toArrayFromCsv('dev');
  9. expect(result).toStrictEqual(['dev']);
  10. });
  11. test('case 3', () => {
  12. const result = toArrayFromCsv('');
  13. expect(result).toStrictEqual([]);
  14. });
  15. test('case 4', () => {
  16. const result = toArrayFromCsv('dev, general');
  17. expect(result).toStrictEqual(['dev', 'general']);
  18. });
  19. test('case 5', () => {
  20. const result = toArrayFromCsv(',dev,general');
  21. expect(result).toStrictEqual(['dev', 'general']);
  22. });
  23. });