-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.js
33 lines (28 loc) · 1.7 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*!
* pad-right <https://github.com/jonschlinkert/pad-right>
*
* Copyright (c) 2014-2015 Jon Schlinkert.
* Licensed under the MIT License
*/
'use strict';
/* deps: mocha */
var should = require('should');
var pad = require('./');
describe('pad right', function () {
it('should return the string when no padding amount is passed.', function () {
pad('abc').should.equal('abc');
});
it('should pad the string to meet the given length', function () {
pad('abc', 5).should.equal('abc00');
pad('abc', 6).should.equal('abc000');
pad('abc', 10).should.equal('abc0000000');
pad('abc', 100).should.equal('abc0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
pad('abc', 300).should.equal('abc000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
});
it('should pad using the given string.', function () {
pad('abc', 10, ' ').should.equal('abc ');
pad('abc', 10, '~').should.equal('abc~~~~~~~');
pad('abc', 100, '~').should.equal('abc~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
pad('abc', 300, '~').should.equal('abc~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
});
});