forked from bakoliasn/basic-javascript-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrepeatString.js
More file actions
21 lines (16 loc) · 722 Bytes
/
Copy pathrepeatString.js
File metadata and controls
21 lines (16 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
var expect = require('chai').expect;
var repeatString = require('../workshop').repeatString;
describe('repeatString', function() {
it('Should repeat a string correctly', function() {
expect(repeatString('hello', 3)).to.equal('hellohellohello');
});
it('Should work with spaces and non-alpha characters', function() {
expect(repeatString('!@# $%^', 2)).to.equal('!@# $%^!@# $%^');
});
it('Should return empty string if given a negative repeater as input', function() {
expect(repeatString('hello', -1)).to.equal('');
});
it('Should return an empty string if given an empty string as input', function() {
expect(repeatString('', 10)).to.equal('');
});
});