describe('words', () => { it('returns empty for empty', () => { expect(words('')).to.eql([]); }); it('turns space separated words into array', () => { expect(words(`I told you`)).to.eql(['I', 'told', 'you']); }); it('splits on path-like separators', () => { expect(words(`I.told/you`)).to.eql(['I', 'told', 'you']); }); it('splits list-like separators', () => { expect(words(`I, told,you`)).to.eql(['I', 'told', 'you']); }); it('ignores extra whitespace', () => { expect(words(`I told you `)).to.eql(['I', 'told', 'you']); }); it('allows new lines', () => { expect(words(` a bunch of stuff `)).to.eql(['a', 'bunch', 'of', 'stuff']); }); it('ignores extra whitespace', () => { expect(words(`interpolation ${'still'}-works well`)).to.eql( ['interpolation', 'still-works', 'well'] ); }); });