Skip to content

Instantly share code, notes, and snippets.

@mauteri
Created July 19, 2021 19:23
Show Gist options
  • Save mauteri/14820708d18a348c473507ff4493490b to your computer and use it in GitHub Desktop.
Save mauteri/14820708d18a348c473507ff4493490b to your computer and use it in GitHub Desktop.
import { commaSeparatedStringToArray } from '../index';
describe('commaSeparatedStringToArray', () => {
test('Returns array from comma separated string', () => {
expect(commaSeparatedStringToArray('my,unit,test')).toEqual(['my','unit','test']);
});
test('Throws when non-string passed', () => {
expect(() => {
commaSeparatedStringToArray(5);
}).toThrow('Parameter was not a string.');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment