forked from bakoliasn/basic-javascript-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwrapWord.js
More file actions
22 lines (17 loc) · 1.26 KB
/
Copy pathwrapWord.js
File metadata and controls
22 lines (17 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
var expect = require('chai').expect;
var wrapWord = require('../workshop').wrapWord;
var largeString = 'the increased productivity fostered by a friendly environment and quality tools is essential to meet ever increasing demands for software.'
var largeStringWordWrapped = 'the increased productivity fostered by a\nfriendly environment and quality tools\nis essential to meet ever increasing\ndemands for software.'
var stringWithLargeWord = 'this string contains a wordthatislargerthanfourtycharactersfortesting the increased productivity fostered by a friendly environment and quality tools';
var stringWithLargeWordWrapped = 'this string contains a\nwordthatislargerthanfourtycharactersfortesting\nthe increased productivity fostered by a\nfriendly environment and quality tools';
describe('wrapWord', function() {
it('Should wrap a string correctly', function() {
expect(wrapWord(largeString)).to.equal(largeStringWordWrapped);
});
it('Should work with strings less than 40 characters', function() {
expect(wrapWord('hello world')).to.equal('hello world');
});
it('Should work with strings containing words of more than 40 characters', function() {
expect(wrapWord(stringWithLargeWord)).to.equal(stringWithLargeWordWrapped);
});
});