Skip to content

Commit a617315

Browse files
author
Evan You
committed
unit test for utils.split
1 parent 30784b5 commit a617315

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/unit/specs/utils.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,25 @@ describe('UNIT: Utils', function () {
4040

4141
})
4242

43+
describe('split', function () {
44+
45+
it('should split by comma and trim', function () {
46+
var res = utils.split(' enter, leave ')
47+
assert.ok(Array.isArray(res))
48+
assert.strictEqual(res.length, 2)
49+
assert.strictEqual(res[0], 'enter')
50+
assert.strictEqual(res[1], 'leave')
51+
})
52+
53+
it('should work with no commas', function () {
54+
var res = utils.split(' sefeffse-fsef ')
55+
assert.ok(Array.isArray(res))
56+
assert.strictEqual(res.length, 1)
57+
assert.strictEqual(res[0], 'sefeffse-fsef')
58+
})
59+
60+
})
61+
4362
describe('defProtected', function () {
4463

4564
it('should define a protected property', function () {

0 commit comments

Comments
 (0)